Question
matlab
mpyutico y Piol yinj 3) (6 pts) Find a) int b) trapz c) integral (2x2 + 2x - 1) dx using the following functions 4) [6 ptsThe
0 0
Add a comment Improve this question Transcribed image text
Answer #1

Code: In the code below in trapz we have taken x value at space of 1 from -3 to 1

clc
clear

syms x
f = 2*x^2 + 2*x - 1;
I_int = int(f, -3, 1)

x = -3:1;
y = @(x)2.*x.^2 + 2.*x - 1;
I_trapz = trapz(x, y(x))

I_integral = integral(y, -3, 1)

Output:

I_int =

20/3

I_trapz =

8


I_integral =

6.6667

Code: But if we take smaller step size in x for trapz it gives better accuracy

clc
clear

syms x
f = 2*x^2 + 2*x - 1;
I_int = int(f, -3, 1)

x = -3:0.01:1; %just taken a smaller step size
y = @(x)2.*x.^2 + 2.*x - 1;
I_trapz = trapz(x, y(x))

I_integral = integral(y, -3, 1)

Output:


I_int =

20/3

I_trapz =

6.6668


I_integral =

6.6667

Add a comment
Know the answer?
Add Answer to:
matlab mpyutico y Piol yinj 3) (6 pts) Find a) int b) trapz c) integral (2x2...
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