HOW TO WRITE THE FUNCTION FOR ODE45
Ältere Kommentare anzeigen
Hi. I am still new in Matlab and i don't know how to write this function for this equation. I know i must use ode45 but i don't know how to write that function coding(for eqn 21 and 22)(I attached with the journal that i referred):

I try to write it but it is have some error, this is how i write:
function dvdt=velocityspinsolver(times,velocities)
dvdt=-g-(Kv/m)*sqrt(v^2+v^2)-Dwv/m;
dvdt=(-Kv/m)*sqrt(v^2+v^2)+Kwv/m; %equation (21)
g=32.174;
K=0.00832;
m=0.59375;
D=0.001452;
w=51;
And this is the error:
Unrecognized function or variable 'g'.
Error in velocityspinsolver (line 2)
dvdt=-g-(Kv/m)*sqrt(v^2+v^2)-Dwv/m;
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 dua (line 44)
[time,velocities] = ode45('velocityspinsolver',0:.005:5, V0);
Akzeptierte Antwort
Weitere Antworten (0)
Kategorien
Mehr zu Loops and Conditional Statements finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

