フィルターのクリア

Is there any way to speed this up?

9 ビュー (過去 30 日間)
Gavin
Gavin 2024 年 5 月 23 日
コメント済み: Gavin 2024 年 5 月 24 日
I have a large (100x100x100) dataset of very small probabilites for electron locations in the hydrogen atom. I am attempting to create a 3-D heatmap of sorts, which I have done, using isosurface and layering many of them ontop of eachother using this code.
figure()
Psi = importdata("psi.mat");
n = 4;
l = 2;
m = 0;
isovalues1 = 1*10^(-(n+2)):1*10^(-(n+2)):1*10^(-n);
for i=1:length(isovalues1)
isosurface(Psi.^2,isovalues1(i))
alpha(isovalues1(i)*10^(n-2));
end
axis equal
axis vis3d
ax=gca; ax.SortMethod='childorder';
colorbar
title(['N = ',num2str(n),', L = ',num2str(l),', M = ',num2str(m)])
This works. But as you can imagine, making 100 isosurfaces at a time can be quite slow. I was wondering if there was any way to speed up what I have or perhaps another way to make a 3-D heatmap.

採用された回答

Cris LaPierre
Cris LaPierre 2024 年 5 月 23 日
編集済み: Cris LaPierre 2024 年 5 月 24 日
My question is if it has to be done with isosurfaces. Here's an approach that uses scatter3. You can adjust the marker size to change how the data is displayed. It does look different, but it seems all the important info is still there.
load("psi.mat",'Psi');
n = 4;
l = 2;
m = 0;
% create (x,y,z) coordinates
[X,Y,Z] = meshgrid(1:size(Psi,2),1:size(Psi,1),1:size(Psi,3));
isovalues1 = 1*10^(-(n+2)):1*10^(-(n+2)):1*10^(-n);
% discretize the data by isovalues
[bin,edges] = discretize(Psi.^2,isovalues1);
% Plot data
idx = bin(:)>0;
scatter3(X(idx),Y(idx),Z(idx),1,isovalues1(bin(idx)),'filled')
alpha(isovalues1(bin(idx)).*10^(n-2))
axis equal
axis vis3d
colorbar('TickLabels',isovalues1)
title(['N = ',num2str(n),', L = ',num2str(l),', M = ',num2str(m)])
  1 件のコメント
Gavin
Gavin 2024 年 5 月 24 日
wow yes thank you! thats perfect. Im still a little new to matlab so this didnt even cross my mind as a possibility.
thanks again

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeLighting, Transparency, and Shading についてさらに検索

製品


リリース

R2024a

Community Treasure Hunt

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

Start Hunting!

Translated by