how to shade area bounded by the curves x=1 and y =4-x^2?
1 回表示 (過去 30 日間)
古いコメントを表示
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 件のコメント
回答 (1 件)
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.
参考
カテゴリ
Help Center および File Exchange で Surface and Mesh Plots についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!