Hi guys, I need some help solving the following question using matlab:
My Attempt:
is the time at which the object hits the ground (when the height =0, or the root/x-intercept of the graph).
I have to use this Newton Raphson formula:
so here's my Matlab command:
But unfortunately I get the following error:Code:theta=pi/4; v=10; g=9.81; a=0.1; n_itn=3; y(1)=0; for k=1:n_itn y=((1-exp(-a*t))/a)*((g/a)+v*sin(theta))-((g*t)/a) y'=diff(y) y(k+1)=y(k)-y(k)/y'(k) end
I don't understand what's the problem with line 6. Can anyone help?Code:??? Error: File: Q1.m Line: 6 Column: 3 The expression to the left of the equals sign is not a valid target for an assignment.
P.S.
Just to have a confirmation I already tried to estimate the root by ploting y versus t and I think the root is around 1.41, here are my commands:
Code:theta=pi/4; v=10; g=9.81; a=0.1; nfinal=2; t=1:0.01:nfinal; x=((1-exp(-a*t))/a)*v*cos(theta); y=((1-exp(-a*t))/a)*((g/a)+v*sin(theta))-((g*t)/a); plot(t,y,’+')


LinkBack URL
About LinkBacks

