plot circles in R2013a
Show older comments
Hello people,
I am trying to plot a simple circle using this function
plot::Circle2d(4, [10, 10])
but I don't manage. The error I get is "Error: File: CIRCLE_1.m Line: 1 Column: 6 Unexpected MATLAB operator."
What I had in mind was to plot a circle from an equation such as x^2+y^2=16 but the only way I had found is this but I don't find it very nice way:
t = linspace(0,10*pi,100)'; D = [cos(t)-x1 -sin(t)-y1]; plot(D(:,1), D(:,2), 'Color','b', 'LineWidth',0.5)
Whenever I search for a circle in Matlab, it shows the above "plot::Circle2d" but I can't use it. I am new to this new version of Matlab. Am I missing something? Should I include some library? Thank you in advance people.
Answers (2)
Sean de Wolski
on 2 Aug 2013
This is a MuPAD command. You need to open a MuPAD notebook and then enter this command. This can be done by running the following at the MATLAB command prompt or by selecting the MuPAD Notebook App from the Apps gallery.
>>mupad
2 Comments
Jan
on 2 Aug 2013
[Relocated from the answer section]: Iliana wrote
Hello, thank you for your answers! that means that I can't incorporate it in my m-file? Well, I was looking for an easy way to plot a circle.
Sean de Wolski
on 2 Aug 2013
Not easily. I would recommend taking the approach that Jan did with the parametric equations.
"plot::Circle2d(4, [10, 10])" is a command for the symbolic toolbox, see http://www.mathworks.com/help/symbolic/mupad_ref/plot-circle2d.html . If you want to use MuPad, read the corresponding manuals, e.g. http://www.mathworks.com/help/symbolic/mupad_ug/first-steps-in-mupad.html.
For non-symbolic maths, the show Matlab code works and your opinion, that this is not "nice", is just a question of taste. I'd clean it up a little bit:
t = linspace(0, 2*pi, 200); % Not 10*pi
x = cos(t) - x1;
y = -sin(t) - y1;
plot(x, y, 'Color', 'b');
Please explain what "Whenever I search for a circle in Matlab" means explicitly, because the applied search method is obviously broken or biased. When I ask Google for "Matlab circle" I get a lot of useful examples. Even searching in this forum and the FileExchange lead to useful solutions.
3 Comments
Jan
on 2 Aug 2013
[Relocated from the answer section]: Iliana wrote
Dear Jan Simon, I mean that I type what I want in the search place and get these results. Additionally, there is no menu to search for toolboxes, and I find it a bit user unfriendly, I think the old versions where more straightforward.
Jan
on 2 Aug 2013
I'm not sure what "the search place" is. There have been several people in this forum, who prefer the former help system also.
aredhel_vlsi
on 5 Aug 2013
Thank you for your answer ! I made it, my mind had stopped working...Thank you
Categories
Find more on Common Operations 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!