SHARE
TWEET

Untitled

a guest Jul 3rd, 2019 56 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 =15;
  6.  
  7. a = 0;
  8. b = 5;
  9. n = 500;
  10. step = (b-a)/n;
  11.    
  12.  
  13.    
  14. for i=1 :n+1
  15.     x(i) = a + (i-1) * step;
  16.     y=zeros(1,i);
  17.     real(i)=(5/3)*e^(-x(i))-(2/3)*cos(sqrt(2)*x(i))+((2*sqrt(2))/6)*(sin(sqrt(2)*x(i)));
  18. endfor
  19.  
  20.  
  21. for k = 2 : k_max
  22.    
  23.     for i = 1 : size(x, 2)
  24.          temp = 0;
  25.          for j = 1 : i
  26.               temp = temp + K(x(i)-x(j))*y(k-1,j)*step;
  27.          end
  28.        temp = temp + f(x(i));
  29.        temp = temp * lambda;
  30.        
  31.         y(k,i) = temp;
  32.     end
  33.    
  34. end
  35. plot(x,y(k_max,:),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