Professional Documents
Culture Documents
'
< +
! Q N tan 1D!
! Q N tan
1
1
a if a b
a if a b
MATLAB EXERCISE
1. /ompute the $ollowing 4uantities.
aQ
1
- -
-
2
1
1
1 2
2
,
_
,
_
cQ
1
(
1
2
r with r Area
2. /alculate the $ollowing 4uantities6
aQ
Q 1! N log Q, N log Q, N ln ,
-
1!
(
1!
( (
and e e e
bQ
1B(
e
(. /alculate the $ollowing 4uantitiesC
NaQ sin
2
tan , cos ,
B
and
NbQ cot (!
o
, cosec +-
o
NcQ sin
B
cos
B
2 2
+
NdQ y@cosh
2
x 8 sinh
2
x with x @(2H
+. /ompute the $ollowing 4uantities
NaQ
i
i
( 1
( 1
+
NbQ e
+
i
NcQ ;xecute the commands exp Npi2G iQ and exp Npi2iQ
/an you explain the di$$erence between the two resultsR
-. The distance traveled by a ball $alling in the air is given by the e4uation
x @ x E v t E
2
1
at
2
%se ')TL)* to calculate the position o$ the ball at time t @ -
x
!
@ 1!m, v @ 1- ms, and a @ -F.D msec
2
B. 5uppose that x@ ( and y@ +. %se ')TL)* to evaluate the $ollowing expressions.
2
2 2
Q N y x
y x
NcQ
( (
(
u v
v
NdQ
2
(
+
v
D. The $ollowing ')TL)* statement, plots the $unction yNxQ @2e
x 2 . !
$or the range
! S x S1!
x@ !6 !.161!C
y@ 2Gexp N-!.2GxQC
plot Nx, yQC
%se the ')TL)* edit window to create a new empty m-$ile, type-there statements into
the $ile, and save the $ile with the name test1.m. Then execute the program by typing the
name test1 in the command windows. 9hat result do you getR
F. /hange the current directory to mynewdir. Then open an edit window and add the
$ollowing lines.
M /reate an input array $rom 8 2Gpi to 2Gpi
t @ -2 G pi6 pi1!6 2GpiC
M /alculate Tsin NtQT
x @ abs Nsin NtQQC
M #lot result
plot Nt, xQC
5ave the $ile with the name test2.m and execute it by typing test2 in the command
window. 9hat happensR
1!. #lot the $ollowing $unctions using the #L1T $unction6
aQ sinNxQ $or -1! x 1!
bQ sinNxQcosNxQ $or -1! x 1!
cQ cosNxQsinNxQexpNx1!Q $or -1 x 1
11. 9rite a script $ile in ')TL)* that displays the results o$ the $ollowing calculations. Uou
should have a single script $ile that displays all result. The script $ile should clearly
identi$y each problem and pause a$ter each answer. )nswer should be displayed only a$ter
the user presses the key or clicks the mouse.
NaQ N-EBQ2 in short $ormat.
NbQ The value o$ -
to 1B digits
NcQ The value o$ e displayed as a $raction Nratio o$ two whole numbersQ.
NdQ %se the ')TL)* $unction dec2hex to $ind how the number B--(- would be
displayed in base 1B NhexadecimalQ
NeQ The result o$ N(EiQ N1EiQ in rectangular coordinates Nnumeric $ormat shortQ.
N$Q The value o$
j 2
NgQ The result o$ N(EiQ G N2E(iQ as a magnitude and a phase.
NhQ The angle o$ N1EiQ Nnumeric $ormat shortQ displayed in degrees.
11
NiQ
- . B
+ (
+ i
N7Q 0ind the real and imaginary parts, magnitude, and angle o$ (E+i.
12