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 Comments

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.
as i said before im new to matlab and i want to get into it that's why im asking for help with the code
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.

Answers (0)

This question is closed.

Products

Release

R2015a

Asked:

on 9 Jan 2022

Closed:

on 9 Jan 2022

Community Treasure Hunt

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

Start Hunting!