help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Pc(2): out of bound 1 error


From: Przemek Klosowski
Subject: Re: Pc(2): out of bound 1 error
Date: Mon, 13 Jan 2020 14:14:40 -0500
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.2.1

On 1/13/20 8:54 AM, Bala Vignesh wrote:
I am trying to solve ODE equation inside a for loop for a given mdot, Ab and
time step. I am getting error .. can anyone help me please

Code:
rhop=1765;
a_burn=2.6292e-5;
n=0.33;
a=1577.1;
Ath=0.008167;
a=1577.1;
b=9e-7;
gamma=0.6465;
Vc=0.0943;
pc0=0;
%
%Read excel files
A=xlsread('Ignition transient.xlsx');
m=A(:,7);
tspan=A(:,4);
Area=A(:,6);
for i=2:40
   mdot=m(i)
   Ab=Area(i)
[t,Pc]= ode45(@(t,Pc)
(mdot+(rhop*Ab*a*Pc^n)-(Pc(i)*Ath/(a+(b*Pc))))*(gamma^2*(a+(b*Pc))^3/(Vc*(a-(b*Pc)))),
tspan, 0);
end

Error message:
error: Pc(2): out of bound 1
error: called from
     ignitionTransient>@<anonymous> at line 29 column 69
     starting_stepsize at line 46 column 5
     ode45 at line 192 column 25
     ignitionTransient at line 29 column 7

On quick perusal, I don't see the definition of Pc, so maybe you just need to initialize it to the correctly sized array.

In order to get further help, please try to minimize your example so that it's self-contained (e.g. you (and I) can run it by pasting it into a fresh instance of Octave).




reply via email to

[Prev in Thread] Current Thread [Next in Thread]