Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- clear;
- x=input('x=');
- h=0.1;
- for m=0:1
- if 1<=x && x<=2
- f=@(x)exp(x+cos((x^2)+m));
- elseif 2<x && x<=3
- f=@(x)exp(2+cos((x^2)+m));
- end
- end
- for m=0:h:1
- for n=0:h:1
- S=h*(f(m)+m(2*n+1)+2*sum(f(1:h:2*n-1))+4*sum(f(2:h:3*n)))/3;
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement