18번 답
clear, clc
r1=[3 -2 1];
r2=[1 2 -4];
Lr1=sqrt(dot(r1,r1));
Lr2=sqrt(dot(r2,r2));
th=acosd(dot(r1,r2)/(Lr1*Lr2))
20번
clear, clc
format short g
g=9.81;
vA=560; thA=43;
vB=680; thB=50;
tA=2*vA*sind(thA)/g;
tB=2*vB*sind(thB)/g;
tf=tA;
t=linspace(0,tf,11);
xA=vA*cosd(thA)*t;
yA=vA*sind(thA)*t-0.5*g*t.^2;
xB=vB*cosd(thB)*t;
yB=vB*sind(thB)*t-0.5*g*t.^2;
rABx=xB-xA;
rABy=yB-yA;
Table=[t' rABx' rABy'];
disp(Table)
24번
clear,clc
na = 0:10;
ya = (-3).^(-na)./(2*na+1);
disp('Part a')
Sa = sqrt(12)*sum(ya)
aPercentError=abs((pi-Sa)/pi)*100
nb = 0:20;
yb = (-3).^(-nb)./(2*nb+1);
disp('Part b')
Sb = sqrt(12)*sum(yb)
bPercentError=abs((pi-Sb)/pi)*100
nc = 0:30;
yc = (-3).^(-nc)./(2*nc+1);
disp('Part c')
Sc = sqrt(12)*sum(yc)
cPercentError=abs((pi-Sc)/pi)*100
26번 답
Script file:
clear, clc
th=75; v=110; g=9.81;
a=g/(2*v^2*(cosd(th))^2);
b=-tand(th);
c=200;
d=sqrt(b^2-4*a*c);
x1=(-b+d)/(2*a);
x2=(-b-d)/(2*a);
xp=linspace(0,x1,100);
y=tand(th).*xp-g/(2*v^2*(cosd(th))^2)*xp.^2;
plot(xp,y)
[hm, xm]=max(y);
hmax=hm
xhmax=xp(xm)
30번
u=0:.05:1;
k=.25;
p=k*u.*(1-u)./(k+u);
pmax05 = max(p)
u=0:.01:1;
p=k*u.*(1-u)./(k+u);
pmax01 = max(p)
E = abs((pmax01-pmax05)/pmax01)*100
34번
Script file:
clear, clc
V1=12; V2=24;
R1=20; R2=12; R3=8; R4=6;
R5=10;
A=[-(R1+R2) R1 R2 0
R1 -(R1+R3) 0 0
R2 0 -(R2+R4) R4
0 0 R4 -(R4+R5)]
B=[V1; V2; -V2; 0]
I=A\B
% A table with the value of the current in each resistor
RI=[1 abs(I(1)-I(2))
2 abs(I(1)-I(3))
3 abs(I(2))
4 abs(I(3)-I(4))
5 abs(I(4))]