The x-coordinates of the intersection points between the two graphs are? solx and soly
1 view (last 30 days)
Show older comments
v=[2;0;1;9;0;1;3;0;1];
m=max(v);
n=mean(v);
f=@(x) m-(1/2).*x; % Vectorized
g=@(x) 2.*x.^2-n; % Vectorized
figure
ezplot(f);
hold on
ezplot(g);
hold on
syms x y
eqns=[y==m-(1/2)*x;y==2*x^2-n]; % Array and y==2 instead of y=2 in equation 2
[solx, soly]=solve(eqns,[x y]);
plot(solx(1),soly(1),'b-x',solx(2),soly(2),'b-x')
expr1=m-(1/2)*x;
expr2=2*x^2-n;
I1=int(expr1,[solx(1) solx(2)]);
I2=int(expr2,[solx(1) solx(2)]);
I=I2-I1;
fprintf('The area bounded by the two curves is: %f\n',I);
The area bounded by the two curves is: 34.022481
1 Comment
Star Strider
on 14 Nov 2022
Is there a problem?
v=[2;0;1;9;0;1;3;0;1];
m=max(v);
n=mean(v);
f=@(x) m-(1/2).*x; % Vectorized
g=@(x) 2.*x.^2-n; % Vectorized
figure
ezplot(f);
hold on
ezplot(g);
hold on
syms x y
eqns=[y==m-(1/2)*x;y==2*x^2-n]; % Array and y==2 instead of y=2 in equation 2
[solx, soly]=solve(eqns,[x y]);
plot(solx(1),soly(1),'b-x',solx(2),soly(2),'b-x')
expr1=m-(1/2)*x;
expr2=2*x^2-n;
I1=int(expr1,[solx(1) solx(2)]);
I2=int(expr2,[solx(1) solx(2)]);
I=I2-I1;
fprintf('The area bounded by the two curves is: %f\n',I);
.
Answers (0)
See Also
Categories
Find more on Direct Search in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!