Re: error message

"Dmitri A. Sergatskov" <[email protected]> Thu, 4 Nov 2021 10:50:49 -0400
Newsgroups gmane.comp.gnu.octave.general
Message-ID <CAO+XyQJEGegu+Jkpk6XXVjz1a_AZwONym8B+Y4cHuiKw2UQurw@mail.gmail.com>
On Thu, Nov 4, 2021 at 10:44 AM Tso-min Chou via Help-octave <
[email protected]> wrote:

> Hi,
>
> I tried to run a Matlab code with Octave and it returned with following
> error message.
>
> error: 'rate_eq' undefined near line 10 column 25
> error: called from
>     laser_rate_equation>@<anonymous> at line 10 column 25
>     starting_stepsize at line 46 column 5
>     ode45 at line 192 column 25
>     laser_rate_equation at line 10 column 10
>
> It seems Octave doesn't accept this command [T,Y]= ode45(@(t,y)
> rate_eq(t,y,V),tspan,y0); this is exactly the same way to call function
> with both Matlab and Octave.
>
> How do I fix the problem?
>
> Best Regards,
> Tso-Min
>
> ps; The function rate_eq is
>
> function dy= rate_eq(t,y,V)
> dy = zeros(3,1);
> I = 0.3;
> te = 2.2E-9;
> tp = 1.6E-12;
> BuyukGama = 0.3;
> a = 2.5E-20;
> Betasp=10^-3;
> B=10E-16;
> c=3*10^8;
> e = 1.602E-19;
> ug=4;
> n0 = 1E24;
> h = 6.626074E-34;
> vg= c/ug;
> am=45E2;
> nuu =(c/1300E-9);
> dy(1) = (I/e) - y(1)/te - (BuyukGama*c*a*(y(1)/V-n0)/ug)*y(2);
> dy(2) = (BuyukGama*c*a*(y(1)/V-n0)/ug)*y(2)- y(2)/tp + Betasp*B*y(1)^2/V ;
> dy(3) = h*nuu*vg*am*dy(2)/2;
> end
>
>
Put this function in a separate  file called rare_eq.m

Dmitri.
--


----------
We are transitioning to a web based forum
for community help discussions at
https://octave.discourse.group/c/help