To find intersection, and to calculate the area between two curves for two functions.
29 ビュー (過去 30 日間)
古いコメントを表示
VIDHYA HARINI
2023 年 1 月 7 日
コメント済み: Walter Roberson
2023 年 1 月 8 日
この 質問 は Star Strider
さんによってフラグが設定されました
Hi everyone, kindly please help me in solving this problem. I am new to this matlab. So I am not really sure how to do this.
Hoping for a step-by-step answer.
Let f(x) = e^x - 1 and g(x) = 1 - x^2 for x ∈ [0; 1]. Draw the graphs of the two functions f and g, determine the point of intersection z of the two graphs and calculate the area of the region between the two graphs in [0; z].
Thank you in advance.
2 件のコメント
Walter Roberson
2023 年 1 月 7 日
The area "between" two intersecting real-valued functons is equal to the area of the absolute value of the difference between the two functions. The area of the absolute value of the difference can be calculated symbolically using int()
採用された回答
Sulaymon Eshkabilov
2023 年 1 月 7 日
編集済み: Sulaymon Eshkabilov
2023 年 1 月 7 日
Step 1. Calculation the two functions
x = linspace(0, 1, 200);
f = exp(x)-1;
g = 1-x.^2;
Step 2. Plot the calculated f(x) and g(x) points
plot(x, f, 'b-', x, g, 'r', LineWidth=2), grid on
xlabel('$x$', 'interpreter', 'latex')
ylabel('$f(x), \ g(x)$', 'interpreter', 'latex')
title 'Area between two curves', hold on
Step 3. Find the intersection
[xi,yi] = polyxpoly(x,f,x,g);
mapshow(xi,yi,'DisplayType','point','Marker','o', 'MarkerFaceColor', 'c', 'MarkerSize', 9)
Step 4. Compute the area between the two curves
AREA = trapz(x,f)-trapz(x,g)
4 件のコメント
Walter Roberson
2023 年 1 月 8 日
The area "between" the two curves is the sum:
- area of (higher one minus lower one) between 0 and intersection point; plus
- area of (new higher one minus new lower one) between intersection point and 1.
Which can also be expressed as the absolute value of the difference in the functions.
The calculation you did is the plain difference between the functions -- and the difference goes negative when the functions intersect.
syms t
AREA = int(abs((exp(t)-1) - (1-t.^2)), 0, 1)
vpa(AREA)
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Calculus についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!