use of matlab in physics
Show older comments
You have a force from many forces that is
F=F+Fc-Fv-D
where
F=400 N
Fc=488*exp(-(t/0.67)^2) N
Fv=25.8v
D=0.34911(1-0.25*exp(-(t/0.67)^2)*v^2
i was asked to use eulers method to calculate in matlab the position of a runner who is moving with these forces (F is moving forward motion, Fc is extra motion forward when body is leaned and back is curled, Fv is a force that prevents F to continue to infinity and decreases acceleration as function of v of runner and D is airdrag)
here is what i wrote but without clearly getting a right answer:
vl=[];
x=[];
t=[];
a=[];
vl(1)=0;
n=2;
x(1)=0;
t(1)=0;
dt=0.05;
while x(n-1)<100
F=5;
Fc=6.1*exp(-(t(n-1)/0.67)^2);
Fv=25.8*vl(n-1);
D=0.34911*(1-0.25*exp(-(t(n-1)/0.67)^2))*(vl(n-1))^2;
a(n-1)=F+Fc-Fv-D
vl(n)=vl(n-1)+a(n-1)*dt;
x(n)=x(n-1)+vl(n)*dt;
t(n)=t(n-1)+dt;
n=n+1;
end
plot(t,vl,'r');
hold on
plot(t,x,'g');
legend('vl','x');
Accepted Answer
More Answers (0)
Categories
Find more on Logical in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!