I have been trying to solve these equations -
d2x dt2 = 2 dy dt + x− M(x + E) r3 E − E(x−M) r3 M
d2y dt2 = −2 dx dt + y− My r3 E − Ey r3 M
z1 = x, z2 = dx dt , z3 = y, and z4 = dy dt
but keep getting these errors:-
Unrecognized function or variable 'rE'.
Error in secodef (line 4) zprime=[z(2);2*z(4)+z(1)-((M*(z(1)+E))/rE^3)-((E*(z(1)-M))/rM^3);z(4);-2*z(2)+z(3)-((M*z(3))/rE^3)-((E*z(3))/rM^3)];
Error in odearguments (line 90) f0 = feval(ode,t0,y0,args{:}); % ODE15I sets args{1} to yp0.
Error in ode45 (line 115) odearguments(FcnHandlesUsed, solver_name, ode, tspan, y0, options, varargin);
Error in trial1 (line 13) [t,z] = ode45(@secodef,tspan,Z);
what do I do?

 채택된 답변

darova
darova 2020년 3월 25일

0 개 추천

Variables rE and rM should be in the function

댓글 수: 9

After I move rE and rM into the function I get this as a result:
Not enough input arguments.
Error in secodef (line 8)
rE = sqrt((z(1)+E)^2 +z(3)^2);
darova
darova 2020년 3월 26일
Can you attach the function?
The function is this but coming up with the result:
Not enough input arguments.
Error in secodef (line 8)
rE = sqrt((z(1)+E)^2 +z(3)^2);
What do I do?
Works for me
>> secodef(1,[1 2 3 4])
ans =
2.0000
8.9685
4.0000
-1.0947
Thank you, I got it to work.
However i am trying to plot a graph but the plot is empty and only 2 points can be shown the earth and the moon.
What do I do?
darova
darova 2020년 3월 26일
Please see the image i made for you. I think there is some connection
I understand that z1 = x and z3 = y.
But I don't know what to do to get the graph.
darova
darova 2020년 3월 26일
Do you know how to select columns?
Not really no

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

추가 답변 (0개)

카테고리

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

태그

아직 태그를 입력하지 않았습니다.

질문:

2020년 3월 25일

댓글:

2020년 3월 26일

Community Treasure Hunt

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

Start Hunting!

Translated by