Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- clear all;
- clc;
- lambda = 1;
- k_max =15;
- a = 0;
- b = 5;
- n = 500;
- step = (b-a)/n;
- for i=1 :n+1
- x(i) = a + (i-1) * step;
- y=zeros(1,i);
- real(i)=(5/3)*e^(-x(i))-(2/3)*cos(sqrt(2)*x(i))+((2*sqrt(2))/6)*(sin(sqrt(2)*x(i)));
- endfor
- for k = 2 : k_max
- for i = 1 : size(x, 2)
- temp = 0;
- for j = 1 : i
- temp = temp + K(x(i)-x(j))*y(k-1,j)*step;
- end
- temp = temp + f(x(i));
- temp = temp * lambda;
- y(k,i) = temp;
- end
- end
- plot(x,y(k_max,:),x,real);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement