plotting matrix with the command plot and meshgrid. Please clarify that to me.
Show older comments
Suppose I create a simple matrix y = [ 2 4; 6 1] and then when I plot it using plot like, plot(y,'*') I tried to understand how it works and I realize the x-axis are the matrix rows and the y-axis is the elements of the matrix. Am I right? if so, why it works like that? why not x-axis gives the column for instance? when I plot 2 matrix such as let x be x = y.^2 and then plot(x,y,'*') in this case the elements of x and y are put together.... is it the same when using other plot commands like mesh, surf,plot3 and so on... ?
**meshgrid
suppose I have x = linspace(-3,3) ; y = x ; I thought it'd be the same doing this z = x.^2 + y.^2 ; [xx yy zz ] = meshgrid(x,y,z) or this [xx yy] = meshgrid(x,y) ; z = xx.^2 + yy.^2 ... this last z I thought it should be the same guy as zz but actually they don't even have the same size.. What's the difference between it? ( defining z in terms of x and y and put everyone into the meshgrid AND defining z in terms of xx and yy which were put into the meshgrid before z was set) ...
Thank you for helping me. I'm a beginner sorry if those questions are stupid.
Accepted Answer
More Answers (0)
Categories
Find more on Creating and Concatenating Matrices 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!