フィルターのクリア

from 1D vector to mesh plot

7 ビュー (過去 30 日間)
Andrea Somma
Andrea Somma 2022 年 11 月 3 日
コメント済み: Andrea Somma 2022 年 11 月 5 日
If I have a 1D vector in space(radius) and concentration for example, is there a simple way to create a meshplot with a circular simmetry? as if the plot has been rotated around the (0,0) and the concentration is displayed with colors (as in surf)
like from the image on the left to the image on the right (sorry I am bad at drawing)

採用された回答

Jan
Jan 2022 年 11 月 3 日
編集済み: Jan 2022 年 11 月 3 日
% The grid:
x = linspace(-3, 3, 50);
y = linspace(-3, 3, 50);
R = sqrt(x.^2 + (y.').^2);
% The concentration:
Cx = linspace(0, 3, 100);
Cy = zeros(size(Cx));
Cy(1:50) = 3;
Cy(51:90) = linspace(3, 0, 40);
% The value:
z = interp1(Cx, Cy, R);
mesh(x, y, z)
imagesc(z)
  4 件のコメント
Jan
Jan 2022 年 11 月 5 日
interp1 and interp1q are slower than griddedInterpolant.
Andrea Somma
Andrea Somma 2022 年 11 月 5 日
Thank you!

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeSurface and Mesh Plots についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by