필터 지우기
필터 지우기

how can i fix this error

조회 수: 2 (최근 30일)
Fahad Ramzan
Fahad Ramzan 2021년 4월 12일
답변: Star Strider 2021년 4월 12일
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')

답변 (1개)

Star Strider
Star Strider 2021년 4월 12일
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.

카테고리

Help CenterFile Exchange에서 Numeric Solvers에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by