Linear differential equation code errors
정보
이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.
이전 댓글 표시
I'm trying to solve
y = sqrt(x*dx/dt) or y=-sqrt(x*dx/dt)
with a function and ode 45 and i get several errors
function f=dif32(t,x);
f=[sqrt(x*dx/dt);-sqrt(x*dx/dt)];
***********
T=[0,10];
x0=[sqrt(2),0]
[t,x]=ode45(@dif32,T,x0);
plot(t,x),grid,title('dif'),legend('x1''x2')
Undefined function or variable 'dx'.
Error in dif32 (line 2)
f=[sqrt(x*dx/dt);-sqrt(x*dx/dt)];
Error in odearguments (line 87)
f0 = feval(ode,t0,y0,args{:}); % ODE15I sets args{1} to yp0.
Error in ode45 (line 113)
[neq, tspan, ntspan, next, t0, tfinal, tdir, y0, f0, odeArgs, odeFcn, ...
Error in Untitled4 (line 3)
[t,x]=ode45(@dif32,T,x0);
댓글 수: 3
John D'Errico
2022년 1월 9일
편집: John D'Errico
2022년 1월 9일
This is now the 4th time you have asked the exact same question. You have gotten an answer on at least one of them Stop posting it over and over again.
Read the help for ode45, where you will find examples of usage. Note that in MATLAB, you don't write a derivative as dx/dt, and just hope that MATLAB will know that you intended that as a derivative.
Finally, this is NOT a linear differential equation.
James Sm.
2022년 1월 9일
John D'Errico
2022년 1월 9일
You got an answer to exactly the same question from Torsten. If you have a question where you don't understand the solution he gave, then ask it of him there.
답변 (0개)
이 질문은 마감되었습니다.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!