error: x(2): out of bound 1
Show older comments
I have code of the following. I did everything I could do, but couldnt overcome this error.
When I execute the below function I get the error
function [disp_dot]=stage2(x,t)%Stage_2 calculation for displacement and pressure
m=23.5; %Stage_2:From bottom choked till bottom is exhausted; top is exhausted
ODB=0.122;
IDB=0.04625;
g=9.8;
ODT=0.104;
IDT=0.042;
Patm=100000;
dt=0.0001; %time increment value
L=0.11; %This is the length where adiabatic condition starts in top chamber; the length of the leg of the air distributor
AT = pi*(ODT^2-IDT^2)/4;
AB = pi*(ODB^2-IDB^2)/4;
PT=Patm;
ODSBD=0.1285;
IDSBD=0.122;
ASBD=pi*(ODSBD^2-IDSBD^2)/4;
ASB=0.00451183;
AST=0.001267892;
CFM=840; %air inflow
CFMm=CFM*(1/2118.88);
v=CFMm/AB;
v=5;
PST=Patm;
PSB=Patm;
PT=Patm;
LB=0.0259; %This is the length where bottom chamber becomes adiabatic during upward displacement of the piston
PBinitial=((PT*AT)+(m*g)+(PST*AST)-(PSB*ASB))/AB;
KB=PBinitial*(AB*LB)^1.4;
disp_dot(1) = x(2);
disp_dot(2) = (1/m)*((KB*AB/(0.000058402+((ASBD+AB)*x(1))^1.4)-(PT*AT)-(m*g)+(PSB*ASB)-(PST*AST)); %Constant value is from bottom channel 4 in excel
end
Accepted Answer
More Answers (0)
Categories
Find more on Loops and Conditional Statements in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!