Hello, so I want to plot X on the Y-axis with Y on the X-axis with Y ranging from [-10 10]. However values of X depend on A which depends on Y so I cant figure out how I can plot Y with values ranging from [-10 10] and have X on the Y-axis. I realize I can initially make Y an array but i want infinite data points in the interval. Sorry if the wording is confusing.

2 件のコメント

Maxwell Yant
Maxwell Yant 2020 年 2 月 21 日
sorry this is my first post I dont know why it printed out like a line of code
Stephen23
Stephen23 2020 年 2 月 22 日
"sorry this is my first post I dont know why it printed out like a line of code"
I don't think it is anything that you did: some recent changes to this forum seem to incorrectly format the first paragraph as code, I have seen quite a few questions like this in the last week or so.
I just fixed your question by selecting the text and clicking the TEXT button:

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

 採用された回答

Star Strider
Star Strider 2020 年 2 月 21 日

0 投票

Since ‘A’ is a function, it must be evaluated in order to use its results.
Try this:
A = @(y) y*2;
X = @(y) A(y)+10;
figure
fplot(X, [-10 10])
Also, note the slight changes in the code.

4 件のコメント

Maxwell Yant
Maxwell Yant 2020 年 2 月 21 日
Thankyou!!! and what does figure do?
Star Strider
Star Strider 2020 年 2 月 21 日
As always, my pleasure!
the figure call creates a figure object so that if there are any otther plot objects existing, it will not over-write them. I always create a figure object when I want to plot something, for that reason.
Maxwell Yant
Maxwell Yant 2020 年 2 月 21 日
ok thanks again!
Star Strider
Star Strider 2020 年 2 月 22 日
As always, my pleasure!

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

その他の回答 (0 件)

カテゴリ

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by