help-octave
[Top][All Lists]
Advanced

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

Re: Code question


From: 이태훈
Subject: Re: Code question
Date: Tue, 28 Apr 2020 20:25:56 +0200

Dear all 
Thank you for the answer.
I think the  triplequad doesn’t help. Because the equations are all independent.
I want to loop the whole process as below. 
Eq1 integration ==> solution from Eq1 ==> insert to Eq2 ==> integration of Eq2==>  solution from Eq2 ==> insert to Eq3==> get “X” and insert it again to Eq1.

I correct my codes. But get this error. 
The question : Is this the right way to loop? If it’s not please tell me how to do it.
Thank you/
> Eulernew

m =  3.1400
I =

   51    1

I =

   1   1

A = -0.0046009
A = -0.046009
error: Y(3): out of bound 2
error: called from
    Eulernew at line 26 column 8


Code :
t0 = 0 ;
   y0 = 0.1 ;
   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;
   a=3;
   b=3;
   Q=pi;
  %% initializing Solution for I
   m = [3.14]
   I = [N+1,1] 
   I(1)= I0
   Y = [N+1,1]';
   Y(1) = y0;
   
  %% 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).+(Q.*A);
      Y(i+1) = Y(i).+(h.*fi);
      end
  
  %% initializing Solution for u
   R = [0:0.5:3.14]
   U = [N+1,1] 
   U(1)= 0
 
  %% solving euler Ex 
  for i=1:N
      B=(2.*(umax./(r.^2))).*((b.*(A)))./(A.+km)
      U(i+1) = U(i).+(h.*B);
      end
  %%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.^(B.-D).*T(i);
       Y(i+1) = Y(i).+(h.*fi);
     
     end

Explanation


equation1 
I want to integrate equation1 numerically and put the solution to equation2 (see I(b,X))
 


And than I should  integrate equation2 numerically and put the solution to equation3 



       

2020. 4. 28. 오전 4:18, Nicholas Jankowski <address@hidden> 작성:


 
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.


Integral3 would be another option. recommend reading up on the different numerical integrators and options available:



reply via email to

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