该楼层疑似违规已被系统折叠 隐藏此楼查看此楼
clc;clear;clf
%数据文件
E=1.4E+3;
Cq=0.61;
md=950 ;
Ps=28 ;
P0=0.05;
ts=0.017453292 ; %ts=pi/180
sita1=7*ts;
sita2=40*ts;
gama=18.1*ts;
d=20;
F=pi*d^2/4;
n=2200;
w=n*2*pi/60;
R=40.5;
V0=7009 ;
% 欧拉法求微积分方程
for t=-4:0.1:12
t
fi=t*ts
A=(R^2*tan(sita1)^2*tan(sita2))*(8.32+fi)^2
k=(t+4)/0.1+1
y(1)=28;
if t<0
y(k+1)=-E*F*R*tan(gama)*sin(fi)/V0+E*Cq*A*sqrt(2*(y(k)-P0)/md)/(w*V0)
else
y(k+1)=-E*F*R*tan(gama)*sin(fi)/V0-E*Cq*A*sqrt(2*(y(k)-P0)/md)/(w*V0)
end
end
程序报错,y(3)为何不能求解。
Attempted to access y(2); index must be a positive integer or logical.
Error in Untitled2 (line 29)
y(k+1)=-E*F*R*tan(gama)*sin(fi)/V0+E*Cq*A*sqrt(2*(y(k)-P0)/md)/(w*V0)