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일

1 개 추천

% 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

Andrea Somma
Andrea Somma 2022년 11월 3일
thank you really appreciated!
Andrea Somma
Andrea Somma 2022년 11월 3일
@Jan is there a way to use interp1q instead of interp1? since i need to draw that figure for each time i need to interpolate many data and the plot is pretty slow
Jan
Jan 2022년 11월 5일
interp1 and interp1q are slower than griddedInterpolant.
Andrea Somma
Andrea Somma 2022년 11월 5일
Thank you!

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 2-D and 3-D Plots에 대해 자세히 알아보기

태그

질문:

2022년 11월 3일

댓글:

2022년 11월 5일

Community Treasure Hunt

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

Start Hunting!

Translated by