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!