This is a Matlab grader problem for calculating the jumper's distance, I follow the code that my professor was provided, what am I missing here to get the final disnace?
function Dist = BJump
z0 = [0;0;pi/8;10];
dt = 0.1;
T = zeros(1,1000);
T(1) = 0;
Z = zeros(4,1000);
Z(:,1) = z0;
for j = 1:10000-1
K1 = physics(T(j),Z(:,j));
K2 = physics(T(j) + dt/2,Z(:,j) + dt/2*K1);
K3 = physics(T(j) + dt/2,Z(:,j) + dt/2*K2);
K4 = physics(T(j) + dt,Z(:,j) + dt*K3);
Z(:,j+1) = Z(:,j) + dt/6*(K1 + 2*K2 + 2*K3 + K4);
T(j+1) = T(j) + dt;
end
function dzdt=physics(t,z)
dzdt = 0*z;
dzdt(1) = z(4)*cos(z(3));
dzdt(2) = z(4)*sin(z(3));
dzdt(3) = -9.81/z(4)*cos(z(3));
D = (0.72)*(0.94)*(0.5)/2*(dzdt(1)^2 + dzdt(2)^2);
dzdt(4) = -D/80-9.81*sin(z(3));
end
end

댓글 수: 4

madhan ravi
madhan ravi 2020년 7월 11일
Did you upload any pictures ? But there’s a lot of space and nothing’s visible.
John D'Errico
John D'Errico 2020년 7월 11일
Can you learn to use descriptive subjects, instead of just asking everytime, "What am I missing here?"
John D'Errico
John D'Errico 2020년 7월 11일
The white space is a (large) image of the problem statement. You need to scroll to the right to see it all.
madhan ravi
madhan ravi 2020년 7월 11일
Ah, yes John ;). Been using mobile for the past 30 days so it’s really difficult to answer questions.

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

도움말 센터File Exchange에서 MATLAB에 대해 자세히 알아보기

질문:

2020년 7월 11일

댓글:

2020년 7월 11일

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by