help-octave
[Top][All Lists]
Advanced

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

Re: Code question


From: Brett Green
Subject: Re: Code question
Date: Mon, 27 Apr 2020 19:51:50 -0400


On Mon, Apr 27, 2020 at 7:32 PM Brett Green <address@hidden> wrote:

I tried running this. One error is the line
fi = 20.*2.717.^(B.-D).*T(i));

which has an extra right parenthesis. It should be replaced with
fi = 20.*2.717.^(B.-D).*T(i);

In the block of code
  %% solving euler Ex
  for i=1:N
      A=(I0./3.14).*exp((-a).*(Y(i)).*(((b.*cos(m)).+((r.^2).-((b.^2).*(sin(m)).^2)).^0.5)))
      I(i+1) = I(i).+(h.*A);
      end

you are using the variable Y before you define it. You need to define Y first before you can do any calculation with it.

Are these the errors you've had so far?

P.S. You can type "pi" instead of approximating it with 3.14.
>> pi
ans =  3.1416
 
Also, Octave has a built-in function for triple integration, triplequad. You can use this to avoid having to write your own numerical integration script.

reply via email to

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