Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function [y, err] = mcm(N)
- lowerBound = 0;
- upperBound = 1;
- dim=5;
- S=0;
- fun = @(x_1, x_2, x_3, x_4, x_5)((x.^3)+3/4).*((x_1.^3)+3/4).*((x_2.^3)+3/4).*((x_3.^3)+3/4).*((x_4.^3)+3/4).*((x_5.^3)+3/4);
- for i=1:N
- x=rand(1,dim);
- S=S+feval(fun,x);
- end
- y = S / N;
- err = abs(quad(fun, lowerBound, upperBound) - y(5));
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement