Error using mupadengine/feval_internal
Show older comments
I'm trying to run this simple code in Matlab but I'm getting this error:
" Error using mupadengine/feval_internal
System contains a nonlinear equation in 'diff(y(x), x, x)'. The system must be quasi-linear: highest
derivatives must enter the differential equations linearly.
Error in odeToVectorField>mupadOdeToVectorField (line 171)
T = feval_internal(symengine,'symobj::odeToVectorField',sys,x,stringInput);
Error in odeToVectorField (line 119)
sol = mupadOdeToVectorField(varargin);
Error in Untitled (line 11)
[VF,Subs] = odeToVectorField(ode);"
Could anyone please help me with this problem? I'm new to Matlab.
My code is :
syms y(x) x Y
r=0.05;
m=0.01;
p=1;
s=1;
a=0.25;
b=0.25;
Dy = diff(y);
D2y = diff(y,2);
ode= y-1/x*1/(r-((p*Dy*x*(s^2))/y)+((D2y*x*(s^2))/(2*y))+((Dy*(m-(s^2)))/y))^(1/(1-a-b));
[VF,Subs] = odeToVectorField(ode);
odefcn = matlabFunction(VF, 'Vars',{x,Y});
tspan = [20 80];
ic = [1 0];
[x,y] = ode45(odefcn, tspan, ic);
figure
plot(x, y)
grid
legend(string(Subs), 'loc','best')
Accepted Answer
More Answers (0)
Categories
Find more on Ordinary Differential Equations in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!








