how to solve this
1 view (last 30 days)
Show older comments

Answers (1)
John D'Errico
on 25 Dec 2022
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 Comments
John D'Errico
on 25 Dec 2022
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
And now we can modify any of those properties.
set(gca,'XLim',[-5,5],'YLim',[-5,5])
See Also
Categories
Find more on Creating, Deleting, and Querying Graphics Objects in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

