plot a surface inside a circle of radius R

17 ビュー (過去 30 日間)
Elizabeth Diaz Bueno
Elizabeth Diaz Bueno 2022 年 2 月 25 日
コメント済み: Voss 2022 年 2 月 26 日
I have a matrix T, which represents cornea local thickness. I wan to clean up the borders and plot T inside a circle or radius r ( turn image on the left side onto image on the right side).

採用された回答

Voss
Voss 2022 年 2 月 25 日
編集済み: Voss 2022 年 2 月 25 日
You can set the elements of T beyond a certain distance from the origin (i.e., the center of the circle) to NaN so they don't show up.
% first, make a rough approximation to your initial
% image because I do not have your data:
r = 5.7;
x = -r:0.01:r;
y = -r:0.01:r;
[X,Y] = meshgrid(x,y);
T = (X.^2+Y.^2)/r^2;
surf(X,Y,T,'EdgeColor','none');
view([0 90]);
set(gca(),'CLim',[0.3 1]);
colormap('jet');
colorbar();
xlabel('X');
ylabel('X');
title('Thickness');
% NaNs don't show up in the surface plot, so to make the region outside the
% circle disappear:
T(X.^2+Y.^2 > r^2) = NaN;
% and plot it the same way (but make the axes invisible)
figure();
surf(X,Y,T,'EdgeColor','none');
view([0 90]);
set(gca(),'CLim',[0.3 1],'Visible','off'); % turn off the axes
colormap('jet');
colorbar();
  2 件のコメント
Elizabeth Diaz Bueno
Elizabeth Diaz Bueno 2022 年 2 月 26 日
This is what I need, Thanks!
My figure isn't as smooth as yours but it'll do. ( I've attached the files, I realized I forgot to do it before)
Voss
Voss 2022 年 2 月 26 日
You're welcome!

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

その他の回答 (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