SHARE
TWEET

Untitled

a guest Jun 17th, 2019 66 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. clear all;
  2. clc;
  3.  
  4. lambda = 1;
  5. k_max = 25;
  6. k = 1;
  7.  
  8. a = 1;
  9. b = 20;
  10. n = 150;
  11. step = (b-a)/n;
  12.    
  13.  
  14.    
  15. for i=1 :n+1
  16.     x(i) = a + (i-1) * step;
  17.     %y(1,i)=f(x(i));
  18.     y=zeros(1,i);
  19.     real(i)=(1/5)*(e^(-x(i))+4*cos(2*x(i))-2*sin(2*x(i)));
  20. end
  21.  
  22.  
  23. for k = 2 : k_max
  24.    
  25.     for i = 1 : size(x, 2)
  26.          temp = 0;
  27.          for j = 1 : i
  28.               temp = temp + K(x(i)) * y(k-1, j) * step;
  29.          end
  30.        temp = temp + f(x(i));
  31.        temp = temp * lambda;
  32.        
  33.         y(k,i) = temp;
  34.     end
  35.    
  36. end
  37. plot(x,y(k_max,:),x,real);
  38. %plot(x,real);
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top