| The real one for ballistic problem. |
Here are some pictures of examples done in class.
Conclusion:
Today was a day of learning about the ways to plot with the ez command. We then spent the rest of the day seeing how matlab takes cares of some calculus, integration and differential equations.
%%Hmwk 14
v = [1 2 3 4 5 6] %volume
t = [2494 1247 831 623 499 416] %temperture
z = interp1(v,t,3.8) %interplation of v at 3.8
z1 = interp1(v,t,3.8,'cubic') %interplation of v at 3.8 cubic
z2 = interp1(t,v,1000) %interplation of t at 1000 linear
z3 = interp1(t,v,1000,'cubic') %interplation of t at 1000 cubic
%%Hmwk 14-2
plot(v,t)
coef1 = polyfit(v,t,1) %eq for 1 order
coef2 = polyfit(v,t,2) %eq for 2nd order
coef3 = polyfit(v,t,3) %eq for 3rd order
coef4 = polyfit(v,t,4) %eq for 4th order
c1 = polyval(coef1,v) %polyval of v 1
c2 = polyval(coef2,v) %polyval of v 2
c3 = polyval(coef3,v) %polyval of v 3
c4 = polyval(coef4,v) %polyval of v 4
plot(v,t,'o',v,c1) %plot w/ 1st order
plot(v,t,'o',v,c2) %plot w/ 2nd order
plot(v,t,'o',v,c3) %plot w/ 3rd order
plot(v,t,'o',v,c4) %plot w/4 order
%% Hmwwk 14-3
n = 1
v = [1 2 3 4 5 6] %volume
P = [2494 1247 831 623 499 416] %temperture
R = 8.314 %R value
k = polyfit(1./v,P,1) %polyfit slop
k2 = polyval(k,1./v) %Polyval uses polfit eq and plus number into
k3 = plot(1./v,k2) %plot of slope
temp = k(1)./R %temperture close to 300K
No comments:
Post a Comment