How do you plot a circle with a str2func()?

1 回表示 (過去 30 日間)
KG
KG 2021 年 11 月 1 日
コメント済み: Walter Roberson 2021 年 11 月 1 日
I was wanting to plot a circle using the str2func(). I'm able to plot the x section but the y section will not work. Thanks!
edit: I"m asking this for a friend, I'm trying to help him with a script that he's trying to write, but I"m not sure how to implement the str2func() to pick up the y values as well as the x values if a user inputs the x and y values.

回答 (1 件)

Matt J
Matt J 2021 年 11 月 1 日
No idea why you think str2func should be part of the task. Why not simply,
fimplicit(@(x,y) x.^2+y.^2-100,11*[-1,+1,-1,+1]); axis equal
  4 件のコメント
KG
KG 2021 年 11 月 1 日
I know it's confusing.
Walter Roberson
Walter Roberson 2021 年 11 月 1 日
S = input('Enter a function in x and y: ', 's');
fun = str2func( "@(x,y) " + S);

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

カテゴリ

Help Center および File ExchangeMATLAB についてさらに検索

製品


リリース

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by