square root on an interval

how to make a figure of the square root on the interval [0,2]. The figure should be smooth, not angular?

回答 (1 件)

Ameer Hamza
Ameer Hamza 2020 年 11 月 8 日

1 投票

One way is to use fplot()
f = @(x) sqrt(x)
fplot(f, [0 2])

4 件のコメント

Jens Petit-jean
Jens Petit-jean 2020 年 11 月 8 日
thanks, but why do you use the @ in front of (x)?
Ameer Hamza
Ameer Hamza 2020 年 11 月 8 日
This creates a function handle. Read about function handle here: https://www.mathworks.com/help/matlab/function-handles.html
Jens Petit-jean
Jens Petit-jean 2020 年 11 月 8 日
okay thank you very much!
Ameer Hamza
Ameer Hamza 2020 年 11 月 8 日
I am glad to be of help!!!

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

カテゴリ

ヘルプ センター および File Exchange2-D and 3-D Plots についてさらに検索

質問済み:

2020 年 11 月 8 日

コメント済み:

2020 年 11 月 8 日

Community Treasure Hunt

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

Start Hunting!

Translated by