The x-coordinates of the intersection points between the two graphs are? solx and soly

1 次查看(过去 30 天)
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 个评论
Star Strider
Star Strider 2022-11-14
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);
The area bounded by the two curves is: 34.022481
.

请先登录,再进行评论。

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Direct Search 的更多信息

标签

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by