how can i fix this error

5 views (last 30 days)
Fahad Ramzan
Fahad Ramzan on 12 Apr 2021
Answered: Star Strider on 12 Apr 2021
clc;
clear all
dsolve('Dy = (10/3)*((x)*(y.^(2/5)))', 'y(0)=1')
Error using symengine
Invalid input. Expected 'expression'.
Error in mupadengine/evalin (line 132)
res = mupadmex(statement,output_type{:});
Error in dsolve>mupadDsolve (line 336)
sys = [sys_sym reshape(evalin(symengine, sys_str), 1, [])];
Error in dsolve (line 194)
sol = mupadDsolve(args, options);
Error in Untitled (line 5)
dsolve('Dy = (10/3)*((x)*(y.^(2/5)))', 'y(0)=1')

Answers (1)

Star Strider
Star Strider on 12 Apr 2021
I have no idea if ‘x’ is a variable or a function, so I am assuming that it is a variable here.
The correct expression would be:
syms x y(t) t Y
Dy = diff(y);
dsolve(Dy == (10/3)*((x)*(y.^(2/5))), y(0)==1)
however there is no analytic expression for ‘y’, so dsolve (with the corrected version of that expression) returns:
ans =
((3*int((10*x(x))/3, x, 0, t, 'IgnoreSpecialCases', true, 'IgnoreAnalyticConstraints', true))/5 + 1)^(5/3)
A numeric integration will require the function to be in a form that the ODE solvers can use:
[VF,Subs] = odeToVectorField(Dy == (10/3)*((x)*(y.^(2/5))));
yodefcn = matlabFunction(VF, 'Vars',{t,Y,x})
that would then be passed (for example to ode45) as:
tspan = [ ];
x = ...;
[t,y] = ode45(@(t,y)yodefcn(t,y,x), tspan, 1);
Or something similar.

Community Treasure Hunt

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

Start Hunting!