Re: 2D Plots



"Anton " <sp6048@xxxxxx> wrote in message <gha0v6$amq$1@xxxxxxxxxxxxxxxxxx>...
New to MATLAB - simple question - how do I 'fix' the axes (so that they always intersect at (0,0), for example) in a 2D plot? EG: I want to plot a unit circle with axes intersecting at origin in middle of plot ...


Hi Anton ;

I found what you asked about ( drawing unity circle with axes intersecting at origin in middle of plot ) here there are two codes you could try :

1st code ( commonly used ) ( center (0,0) & radius = 1 )
th=0:0.1:2*pi;
x=1*cos(th);
y=1*sin(th);
plot(x,y)
grid

2nd code ( center (0,0) & radius = 1 ) but with equal scale of axis
th=linspace(0,2*pi,1000);
x=1*cos(th);
y=1*sin(th);
plot(x,y)
grid
axis equal
Try both & note the difference
I hope i had answered your question
.



Relevant Pages

  • Re: 2D Plots
    ... I found what you asked about (drawing unity circle with axes intersecting at origin in middle of plot) here there are two codes you could try: ...
    (comp.soft-sys.matlab)
  • Re: my RLS program.
    ... subplot ... ylabel ... plot; grid on ...
    (comp.soft-sys.matlab)
  • Re: How to change grid line style?
    ... I sympathize with your request Paul. ... When you enable grids, ... that I wrote my own plotting routine (called plt) ... which I use as a substitute for plot. ...
    (comp.soft-sys.matlab)
  • Re: my LMS program.
    ... xlabel ) ... ylabel ... plot; grid on ...
    (comp.soft-sys.matlab)
  • Re: Help for making surface plot
    ... I will make a surface plot. ... You can grid the data by leaving one blank line between grid rows. ... If you have non-regularly gridded data or you cannot influence the generation of the data file, you can grid your data with dgrid3d, as your are told by the error message. ... set dgrid3d 4,3 ...
    (comp.graphics.apps.gnuplot)

Loading