mesh from 1D (creating a matrix from a vector)
古いコメントを表示
Hello,
I have a vector A[-3:0.003:3] and a vector B whose values corresponding to those of A. I plotted B as a function of A ( it shows a curve like a gaussian). I would like now to plot in 3D using mesh. From vector A, i have to use two vectors x and y and I have to find a matrix from vector B.
Any help and I thank you in advance!
Adam
回答 (1 件)
Matt J
2012 年 11 月 1 日
0 投票
Sounds like MESHGRID or NDGRID is what you want.
4 件のコメント
Matt J
2012 年 11 月 1 日
Well, that depends on the functional form of B. The general benefit of ndgrid/meshgrid, however, is that you can now do element-wise operations involving x and y to generate B:
B=x.^2+y.^2;
mesh(x,y,B);
adam
2012 年 11 月 2 日
Matt J
2012 年 11 月 2 日
Hello, Thank you for your answer. But you didn't understand my question.
Still don't...
カテゴリ
ヘルプ センター および File Exchange で Matrices and Arrays についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!