Borrar filtros
Borrar filtros

matlab求解微分方程报错

16 visualizaciones (últimos 30 días)
Xin Li
Xin Li el 10 de Mzo. de 2022
Respondida: Anjaneyulu Bairi el 10 de En. de 2024
软件情况:64位matlab-R2019a需要用到:Symbolic Math Toolbox
这是程序代码
[function Fin = f(t)
f0=0.012;
t1=5;
tend=360;
a=0.5;
if t>=t1 && t<=tend
Fin = (1+a)*f0;
elseif t>0 && t<t1
Fin = f0+(a*f0)/t1.*t;
elseif t>tend && t<tend+t1
Fin = (1+a)*f0-(a*f0)/t1.*(t-tend);
else
Fin=0.012;
end
end
t=0:1:800;
n=length(t);
fin=[];
for i=1:n
Fin=f(t(i));
fin=[fin Fin];
end
Vv=[];
for i=1:n
Vv1=dsolve('Dvv=fin(i)-0.012*(vv/0.0237)^2/(35*0.012*(vv/0.0237)^-0.5-1)','0.23') ;
Vv=[Vv Vv1];
end]
报错的位置主要在Vv1=dsolve('Dvv=fin(i)-0.012*(vv/0.0237)^2/(35*0.012*(vv/0.0237)^-0.5-1)','0.23') ;这一句,当我去掉后面的参数'0.23时',可以运行,但求不出解析解,执行结果如下
警告: Unable to find explicit solution. Returning implicit solution instead.
> In dsolve (line 208)
In Untitled (line 10)
当我加上'0.23'这个参数时,反而报错不能运行了,运行结果如下
错误使用 mupadengine/feval (line 195)
Invalid equations.
出错 dsolve>mupadDsolve (line 340)
T = feval(symengine,'symobj::dsolve',sys,x,options);
出错 dsolve (line 194)
sol = mupadDsolve(args, options);
出错 Untitled (line 10)
Vv1=dsolve('Dvv==(fin(i)-0.012*(vv/0.0237)^2/(35*0.012*(vv/0.0237)^-0.5-1))','0.23') ;

Respuestas (1)

Anjaneyulu Bairi
Anjaneyulu Bairi el 10 de En. de 2024
Hi,
I understand that you are getting error while solving differential equation using dsolve” function. The dsolve” function should have second argument as condition like vv(0)=0.23. Change the second argument to 'vv(0)=0.23' and it works.
Visit the following documentation link for more information on “dsolve” - https://in.mathworks.com/help/symbolic/dsolve.html
Hope it helps to resolve your query.

Categorías

Más información sobre Symbolic Math Toolbox en Help Center y File Exchange.

Etiquetas

Productos


Versión

R2019a

Community Treasure Hunt

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

Start Hunting!