답변 (1개)

John D'Errico
John D'Errico 2022년 12월 25일

0 개 추천

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
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])

댓글을 달려면 로그인하십시오.

카테고리

도움말 센터File Exchange에서 Graphics Performance에 대해 자세히 알아보기

제품

릴리스

R2022b

태그

질문:

2022년 12월 25일

댓글:

2022년 12월 25일

Community Treasure Hunt

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

Start Hunting!

Translated by