how to shade area bounded by the curves x=1 and y =4-x^2?

1 回表示 (過去 30 日間)
Sagnik Sarkar
Sagnik Sarkar 2020 年 8 月 19 日
コメント済み: Sagnik Sarkar 2020 年 8 月 19 日
syms x4 y4
x4=linspace(-4,4);
y4=4-x4.^2; grid on;
plot(x4,y4)
hold on;
yl = get(gca, 'YLim');
line( [1 1], yl )
hold off;
  3 件のコメント
Sagnik Sarkar
Sagnik Sarkar 2020 年 8 月 19 日
its just says plot it on the same axis and shade the bounded region
Sagnik Sarkar
Sagnik Sarkar 2020 年 8 月 19 日
*the question says

サインインしてコメントする。

回答 (1 件)

John D'Errico
John D'Errico 2020 年 8 月 19 日
Create a sequence of points that define the region you want. Since the function has roots at +/- sqrt(2), it is easy to do.
If you do not know the roots of the function, you woul find them using either roots or solve. Since x == 1 is between the two roots, only you know if you want the region ABOVE or BELOW x == 1 to be shaded.
In either case, you then create a polyshape, and plot the polyshape.
However, since this is surely your homework, with no effort shown, I will not do your homework.
  2 件のコメント
Sagnik Sarkar
Sagnik Sarkar 2020 年 8 月 19 日
i know how to plot i just dont know how to fill the bounded region
Sagnik Sarkar
Sagnik Sarkar 2020 年 8 月 19 日
now see my code i have done that much

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeSurface and Mesh Plots についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by