フィルターのクリア

How to turn a single vector into matrix in order to have mesh or 3D

7 ビュー (過去 30 日間)
adam
adam 2012 年 8 月 24 日
Hello all,
I plotted a vector H versus a vector r. its possible to have a plot 3D, i.e H as a function of x and y. r^2=x^2+y^2. Is there a direct method? Thank you for your suggestions !! Adam

回答 (1 件)

Doug Hull
Doug Hull 2012 年 8 月 24 日
x = linspace(-1,1);
y = linspace(-1,1);
[X,Y] = meshgrid(x,y);
R = sqrt(X.^2 + Y.^2);
surf(X,Y,R)
  1 件のコメント
adam
adam 2012 年 8 月 24 日
Hi doug.Thank you for your answer . But I have a vector H (201,1) whose a values correspond to vlues of vector r (201,1). Therfore I pltted H as a function of r using plot(r,H). Now, I would like to plot in 3D using mesh but H as a function of x and y provided that r=sqrt(x^2+y^2). Thank you

サインインしてコメントする。

カテゴリ

Help Center および File Exchange2-D and 3-D Plots についてさらに検索

タグ

製品

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by