help-octave
[Top][All Lists]
Advanced

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

Re: Code question


From: Thomas D. Dean
Subject: Re: Code question
Date: Mon, 27 Apr 2020 16:25:43 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.4.1

On 2020-04-27 14:58, 이태훈 wrote:
Hi all

I have 3 equations to integrate
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



I have coded what I explain to you. (The Y in this code is the x )
  But it is not running.
Can you tell me what I did wrong?

  t0 = 0 ;
    y0 = 0 ;
    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
   %% initializing Solution for I
    m = [0:0.5:3.14]
    I = [N+1,1]
    I(1)= I0
   %% 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
   %% 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
    plot(T,Y);
    disp(T)


What error messages do you see?

Tom Dean




reply via email to

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