Shade the area under a anonymous function

Im trying to visualize the area between my anonymous function and the x-axle but can't find a way of doing so.
Does someone have a method for this?

2 件のコメント

madhan ravi
madhan ravi 2019 年 1 月 8 日
code ?
Viktor Edlund
Viktor Edlund 2019 年 1 月 8 日
The only thing i have done is that i created an anonymous function and then plot it using fplot()
f=@(x) sin(1-x^3)
fplot(f)

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

 採用された回答

madhan ravi
madhan ravi 2019 年 1 月 8 日

0 投票

f=@(x) sin(1-x.^3)
x=0:0.001:2*pi;
area(x,f(x))

1 件のコメント

Viktor Edlund
Viktor Edlund 2019 年 1 月 8 日
Now i tried to only show the area from -1 to pi but when i do that my x-axel is weird, showing x=0 to x=4500 but the graph is correct. How could i adjust the x-axel to show accurate?
I changed the x vector to this and then used area(f(x)):
>> x=-1:0.001:pi;
>> area(f(x))
Tried to attatch a picture to this comment but wasnt able.

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

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeLine Plots についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by