Question

please use matlab/get someone with a matlab license
Problem 3: Find the value of the integral 0 using the rectangle rule with spacing Δ:: 0.01. Use the code for the rectangle qu

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

dx =0.01;%spacing
x=0:dx:10;%x grid
fx=@(x)cos(x)+x.^2.*exp(-x.^2);
N=(10-0)/dx;
Fx=0;%variable to store integral
for i=1:N
Fx = Fx + dx*fx((x(i)+x(i+1))/2);
end
Fxinteg=integral(fx,0,10);% computed using inbuild matlab
%integral function to check accuracy of computed integral
disp('integral computed using rectangle quadrature is');
disp(Fx);
disp('integral computed using in-built function is');
disp(Fxinteg);

MATLAB output

integral computed using rectangle quadrature is
-0.100909914924232

integral computed using in-built function is
-0.100907648162991

Add a comment
Know the answer?
Add Answer to:
Problem 3: Find the value of the integral 0 using the rectangle rule with spacing Δ:: 0.01. Use t...
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