软件情况: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') ;