MATLAB Answers

0

ERROR: odearguments (line 90), ode45 (line 113)

Asked by EJ_JEONG on 24 Apr 2019
Latest activity Commented on by EJ_JEONG on 24 Apr 2019
function yprime=swing_brake(t,y)
cd=0.6;
A0=0.5*10^(-6);
density=800;
Bulk=2*10^9;
Ap=10^(-4);
M=0.1;
k=40000;
x0=0.005;
V10=10^(-4);
V20=10^(-5);
Amax=0.5*10^(-6);
delP_set=100*10^5;
x=delP_set-y(2);
if (x <= 50)
Ared=Amax;
else
Ared=-Amax/(50-y(2))*(x-50)+Amax;
DelP=y(1)-y(2);
Q2=cd*A0*sqrt(2*y(2)/density);
Qred=cd*Ared*sqrt(2*abs(DelP)/density);
yprime(1)=Bulk*(Ap*y(4)-Qred)/(V10-Ap*y(3));
yprime(2)=Bulk*(Qred-Q2)/V20;
yprime(3)=y(4);
yprime(4)=(k*(x0-y(3))+y(1)*Ap)/M;
end
>>[t,y]=ode45('swing_brake',[0 0.06],[0 0 0 0]);
ERROR:
odearguments (line 90)
SWING_BRAKE must return a column vector.
ode45 (line 113)
[neq, tspan, ntspan, next, t0, tfinal, tdir, y0, f0, odeArgs, odeFcn, ...

  0 Comments

Sign in to comment.

1 Answer

Answer by Stephan
on 24 Apr 2019
Edited by Stephan
on 24 Apr 2019
 Accepted Answer

add:
yprime = zeros(4,1);
before assigning values to yprime

  1 Comment

Thanks Stephan!!
I solved^^.

Sign in to comment.