Question

2. We wish to integrate f(u) = 1/[k (1 - N)], (with constants k = 0.25 and N = 4000) from u= uj = 0.6931 to u= u2 = 7.6009 u

Include a Matlab code as well

0 0
Add a comment Improve this question Transcribed image text
Answer #1

We have solved the given integral using Monte-Carlo method. Calculations are done in MATLAB. (code attached)

het, we are interested in evaluating I-&+(u) dx . det, us consider n rondom variables xi such that, Xi ~ 160,1) (unitor dist

Value of the integral for different run of the code.Command Window >> Monte carlo Value of the integral using 10000 random numbers is: 30.3815 >> Monte_carlo Value of the integr

MATLAB code:

function Monte_carlo

u1=0.6931;
u2=7.6009;
k=0.25;
N=4000;
n=10000; % number random numbers;
  
h = @(y) (u2-u1)./(k*(1-(1/N)*exp((u2-u1)*y+u1)));
y=rand(1,n);
Integral=sum(h(y))/n;
fprintf('\n\nValue of the integral using %g random numbers is: %g\n\n',n,Integral);
end

Add a comment
Know the answer?
Add Answer to:
Include a Matlab code as well 2. We wish to integrate f(u) = 1/[k (1 -...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT