Solving ODE in MATLAB help needed

2 次查看(过去 30 天)
Dale
Dale 2012-10-22
Question: Solve numerically up to t=1
a) x= 20, values for y and z
b) x= 9, values for y and z
Equations:
{dVx/dt= -(k/m)Vx-cVy;}
[dVy/dt= -(k/m)Vy-cVx:]
[dVz/dt= -(k/m)Vz-g:]
I tried the first equation:
function x = test_dVxdt (t,x)
global k m c Vx Vy
x = -(k/m)Vx - cVy;
return
In the command window
k= 0.17;
>> m= 0.43;
>> c= 0.24
c =
0.2400
>> Vx= 26.76;
>> Vy= -2.813;
>> tspan= [0:0.1:1];
>>
>> x= 20;
>> [t, x] = ode45(@test_dVxdt, tspan, x)
But I am getting a lot of errors,
Error using feval
Error: File: test_dVxdt.m Line: 4 Column: 11
Unexpected MATLAB expression.
Error in odearguments (line 88)
f0 = feval(ode,t0,y0,args{:}); % ODE15I sets args{1} to yp0.
Error in ode45 (line 114)
[neq, tspan, ntspan, next, t0, tfinal, tdir, y0, f0, odeArgs, odeFcn, ...
Am I going about the question correctly? Any help would be appreciated.

回答(2 个)

Sachin Ganjare
Sachin Ganjare 2012-10-22
Rfer below link:
Hope you will find the answer!!!

Walter Roberson
Walter Roberson 2012-10-22
-(k/m)Vx does not indicate multiplication in MATLAB. -(k/m) .* Vx
Likewise for other multiplication operations in your code.

类别

Help CenterFile Exchange 中查找有关 Programming 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by