Yahoo Answers is shutting down on May 4th, 2021 (Eastern Time) and beginning April 20th, 2021 (Eastern Time) the Yahoo Answers website will be in read-only mode. There will be no changes to other Yahoo properties or services, or your Yahoo account. You can find more information about the Yahoo Answers shutdown and how to download your data on this help page.
Trending News
Matlab Question, any experts want to lend a hand?
I'm trying to plot a unit square in Matlab, ie S=[0 1 1 0 0; 0 0 1 1 0].
It should be fairly straightforward, but the graph is shifted over one unit to the right every time I try and plot it, in other words, the origin is at (1,0). What is happening, and is there any way to fix it? I need to rotate the square with rotation vectors and with this quirk it's impossible, the rotated square ends up distorted.
Any help very much appreciated, thanks.
2 Answers
- MathLv 78 years agoFavorite Answer
The following matlab code will plot a unit square with vertices (0,0) (1,0) (1,1) (0,1)
vertices = [0 0; 1 0; 1 1; 0 1];
h = patch(vertices(:,1), vertices(:,2), 'w');
axis([-1 2 -1 2])
I have matlab on my computer and have been using it for years