恳请各位高手们救助啊。关于应用ode45计算时,出现了如下结果,
编程一:clc,clear
Pr=25000;
Pa=101000;
D=0.028;
L0=0.137;
m=1.4;
V0=9.5852e-005;
x0=;
t_final=0.018;
=ode45('oppo',,x0,[]);
figure(1)
plot(t,y(:,1))
figure(2)
plot(t,y(:,2))
编程二:
function dx=oppo(t,x)
Pr=25000;
Pa=101000;
D=0.028;
L0=0.137;
m=1.4;
V0=1/4*pi*D^2*L0+1/6*pi*D^3;
dx=[x(2)
(-(Pr+Pa)*(V0/((acos((D-x(1))/D)*D*(D-x(1))+(1/4*pi-1/2*acos((D-x(1))/D))*D^2-(1/2*D-1/2*x(1))*(2*D*x(1)-x(1).^2)^(1/2))*(L0+1/2*pi*x(1))+1/6*pi*(D-x(1)).^3))^m*(1/(1-(D-x(1)).^2/D^2)^(1/2)*(L0+1/2*pi*x(1))+1/2*acos((D-x(1))/D)*D*pi-m/((acos((D-x(1))/D)*D*(D-x(1))+(1/4*pi-1/2*acos((D-x(1))/D))*D^2-(1/2*D-1/2*x(1))*(2*D*x(1)-x(1).^2)^(1/2))*(L0+1/2*pi*x(1))+1/6*pi*(D-x(1)).^3)*((1/(1-(D-x(1)).^2/D^2)^(1/2)*(D-x(1))-acos((D-x(1))/D)*D-1/2*D/(1-(D-x(1)).^2/D^2)^(1/2)+1/2*(2*D*x(1)-(x(1)).^2)^(1/2)-1/2*(1/2*D-1/2*x(1))/(2*D*x(1)-x(1).^2)^(1/2)*(2*D-2*x(1)))*(L0+1/2*pi*x(1))+1/2*(acos((D-x(1))/D)*D*(D-x(1))+(1/4*pi-1/2*acos((D-x(1))/D))*D^2-(1/2*D-1/2*x(1))*(2*D*x(1)-x(1).^2)^(1/2))*pi-1/2*pi*(D-x(1)).^2)*acos((D-x(1))/D)*D*(L0+1/2*pi*x(1)))+Pa*(1/(1-(D-x(1)).^2/D^2)^(1/2)*(L0+1/2*pi*x(1))+1/2*acos((D-x(1))/D)*D*pi))*x(1)/m];
运行后出现了:Warning: Imaginary parts of complex X and/or Y arguments ignored,原函数里有个开根号的,但是手动算过几个数,并不是复数啊,是不是程序本身出问题了呢?高手指点啊……
{:{27}:} 个人时间/水平有限, 仅建议
若LZ确定没复数, 设些断点或增加些判断式找出那裡出现复数, 再看看是否合理 我的问题跟楼主类似 不知你的问题解决没有? 有空试了下LZ的程式, 但根本报错不同!?
Error: File: oppo.m Line: 6 Column: 4
The input character is not valid in MATLAB statements or expressions.
本想试著改, 但LZ的式子那麼长又很乱, 所以放弃了... sorry
页:
[1]