help-octave
[Top][All Lists]
Advanced

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

How to solve warning: division by zero


From: 이태훈
Subject: How to solve warning: division by zero
Date: Tue, 21 Apr 2020 17:13:56 +0200

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:
% Solve ODE-IVP using Euler's Explict Method
  
   t0 = 0 ;
   y0 = 9.8;
   tEnd = 5;
   h= 0.1;
   N = (tEnd.-t0)./(h);
   D=1.1;
   r=0.0984;
   ka=3;
   z=10;
   umax=0.08;
   km=3;
   I0=1;
   
   
   %%Initializing Solution
   
   T = [t0:h:tEnd]';
   Y = [N+1,1]';
   y(1) = y0;
   
   %% Solving using Euler's Explicit Method 
   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
       
   
   disp(Y)
   plot(T,Y);
 

reply via email to

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