HW2 Matlab
HW2 Matlab
DATE: 09/17/2024,
NAME: Cesar A. Pascal
Homework # 2,
Read Chapter #3, Problems:
3.11 (p. 115), 3.2 (p. 118), 3.23 (p. 119)
Script:
>> A = 4;
w = 0.6;
t = [0:1:10];
x = A*cos(w.*t);
Results = [x',t']
Results =
4.0000 0
3.3013 1.0000
1.4494 2.0000
-0.9088 3.0000
-2.9496 4.0000
-3.9600 5.0000
-3.5870 6.0000
-1.9610 7.0000
0.3500 8.0000
2.5388 9.0000
3.8407 10.0000
Answer:
Results =
4.0000 0
3.3013 1.0000
1.4494 2.0000
-0.9088 3.0000
-2.9496 4.0000
-3.9600 5.0000
-3.5870 6.0000
-1.9610 7.0000
0.3500 8.0000
2.5388 9.0000
3.8407 10.0000
Discussion: For this problem I first compute the equation that describe the spring movement
them plugging the number on it. Later to express the results in a table I used ‘ to change invert
row to columns.
D1 = round(rand*5)+1
D2 = round(rand*5)+1
twoDice = D1+D2
BoarGame = twoDice
D1 =5
D2 = 6
twoDice =11
BoarGame = 11
Answer:
a) 5
b) 5,6
c)11
d) 11
Discussion:
On this problem I use random number from 0 to 5 but I add 1 to it because it can’t be 0. I did it
twice simulating both dice and add them to give a total.
Problem: 3.23 (p. 119):
Script:
C = 1*10^(-6)
L = 200*10^(-3)
R=5
f = 15
w = 2*pi*f
V = 10
Zc = 1/(1j*w*C)
Zl = w*L*1j
ZT = Zc+Zl+R
I = V/ZT
Magnitude = abs(I)
Angle = angle(I)
C=
1.0000e-06
L=
0.2000
R=
f=
15
w=
94.2478
V=
10
Zc =
0.0000e+00 - 1.0610e+04i
Zl =
0.0000 +18.8496i
ZT =
5.0000e+00 - 1.0591e+04i
I=
4.4571e-07 + 9.4415e-04i
Magnitude =
9.4416e-04
Angle =
1.5703
Answer:
a)
Zc =
0.0000e+00 - 1.0610e+04i
Zl =
0.0000 +18.8496i
b)
ZT =
5.0000e+00 - 1.0591e+04i
c)
I=
4.4571e-07 + 9.4415e-04i
d)
Magnitude =
9.4416e-04
Angle =
1.5703
Discussion:
Following the directions and math commands I achieve to complete the program using functions
as abs() and angle()