how to solve this

1 回表示 (過去 30 日間)
daniel
daniel 2022 年 12 月 25 日
コメント済み: John D'Errico 2022 年 12 月 25 日
  1 件のコメント
Torsten
Torsten 2022 年 12 月 25 日
How to solve what ?

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

回答 (1 件)

John D'Errico
John D'Errico 2022 年 12 月 25 日
You already solved it. So where is the problem? If I had to guess, it is why the circle you just plotted does not appear circular. For that, you need to learn why it is that you use
axis equal
Which forces the x and y axes to have the same spacing.
Or, maybe why it is that the variables x and y you defined before the call to ezplot have nothing to do with the plot you show, so no impact. That is because ezplot does not use workspace variables.
But maybe your question is something completely different.
  2 件のコメント
daniel
daniel 2022 年 12 月 25 日
How do I change the ranges of x and y according to the image
John D'Errico
John D'Errico 2022 年 12 月 25 日
You probably want to use xlim and ylim. For example, I'll use ezplot, since you did already. (fimplicit or fplot are better (newer) tools though.)
ezplot('x.^2 +x.*y + y.^2 - 3')
By default, ezplot decided to use axes that go to [-6,+6] on each axis. You can change that in several ways.
For example, let me redo the plot, but this time, I'll use xlim and ylim.
ezplot('x.^2 +x.*y + y.^2 - 3')
xlim([-4,4])
ylim([-3,3])
Or, you can use handle graphics calls to modify the plot.
ezplot('x.^2 +x.*y + y.^2 - 3')
The axis handle allows you to change any of those axis properties after the plot was created. It is found by a call to gca.
gca
ans =
Axes ({x}^{2} +{x} {y} + {y}^{2} - {3} = {0}) with properties: XLim: [-6.2832 6.2832] YLim: [-6.2832 6.2832] XScale: 'linear' YScale: 'linear' GridLineStyle: '-' Position: [0.1300 0.1100 0.7750 0.8150] Units: 'normalized' Show all properties
And now we can modify any of those properties.
set(gca,'XLim',[-5,5],'YLim',[-5,5])

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

カテゴリ

Help Center および File ExchangeCreating, Deleting, and Querying Graphics Objects についてさらに検索

タグ

製品


リリース

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by