Home How to plot a rectangular in MATLAB
Reply: 1

How to plot a rectangular in MATLAB

Rosa Published in 2013-12-20 07:29:22Z

It is necessary for me that plot a rectangular in MATLAB by contour. But when I plot this, the figure is like square and no rectangular.

In fact the length of X axis and Y axis are true, but figure is not rectangular.

How could I find a rectangular figure?

Once before I needed to plot a n eliptical by countour and it was like circle, by setting axes([xmin xmax ymin ymax]) this problem was solved but know this command do not work.

Here is my code u0,x,y are 3 vectors of length nx*ny. and nx and ny are the number of points in x axis and y axis.

for i=1:ny

cMap = [0.45 0.6 0.65;1 1 1]; % [green;yellow] on rgb-color
axis equal

Let 's=0:0.1:0.2' and 'x=repmat(s,1,ny)' and 'd=0:0.1:1', 'y=repmat(d,1,nx)' 'u0=x+y'

NKN Reply to 2013-12-20 13:17:30Z

I think the problem is the size of the vector you are using. Check out this example:

x = linspace(0,2,20);
y = linspace(0,1,10);
z = meshgrid(x,y);
axis equal

it gives the following result:

Now if we check the sizes:

>> size(x)

ans =

     1    20

>> size(y)

ans =

     1    10

>> size(z)

ans =

    10    20

if the size of x vector is equal to the size of the y vector it gives you a square obviously! in your case first check the size of x1, y1, z just before using the contourf an make sure that you are using axis equal after that.

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.313541 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO