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!