Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- a = 1;
- b = -4;
- c = 6;
- d = -4;
- e = 1
- ANSWER = fivepoint(0,2*pi,1000,a,b,c,d,e);
- display(ANSWER)
- plot(ANSWER)
- function [output] = F(x)
- output = sin(x).*sin(x);
- end
- function [output] = fivepoint(start,end_point, h, a,b,c,d,e)
- points = linspace(start,end_point,h);
- constant = 1/h^3;
- for i=3:h-2
- output(i) =constant + a * F(points(i+2)) + b * F(points(i+1)) ...
- + c * F(points(i)) + d*F(points(i-1))+e*F(points(i-2));
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement