help-octave
[Top][All Lists]
Advanced

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

Re: How to solve warning: division by zero


From: Markus Mützel
Subject: Re: How to solve warning: division by zero
Date: Tue, 21 Apr 2020 18:37:37 +0200

Am 21. April 2020 um 17:13 Uhr schrieb "이태훈":
> Hi all 
> I use this code for my work, Whenever I run this, I get this:
>  warning: division by zero
>  warning: called from
>     EulerExplict at line 25 column 11
> Can you help me to solve this problem?  
>  
>  
> Code:
[snip]
>    t0 = 0 ;
[snip]
>    T = [t0:h:tEnd]';
[snip]
>    for i= 1:N
>        fi = 
> 20.*2.717.^((umax.*(I0.*2.717.^(((-3).*(Y(i)).*(z))./(I0.*2.717.^((-3).*(Y(i)).*(z))).+km))-D).*T(i));
>        Y(i+1) = Y(i).+(h.*fi);
>      
>      end

T(1) is t0 which is 0. So you are dividing by zero. Hence the warning.

If you want to suppress the warning, have a look at the documentation for 
"warning":
doc warning

Query the id of the last warning with
[~, id] = lastwarn ()

HTH
Markus




reply via email to

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