How to Turn Imagesc to x and y?

1 回表示 (過去 30 日間)
Sushmitha Kudari
Sushmitha Kudari 2020 年 2 月 19 日
コメント済み: Rik 2020 年 2 月 23 日
I have the following file MunkS_500Hz.shd.mat,
munkProfile = load('MunkS_500Hz.shd.mat');
pressureWave = munkProfile.pressure;
pressureWave = abs(pressureWave);
squished = squeeze(pressureWave);
figure
plot(squished);
logged = log(squished)
imag = imagesc(logged);
that I can make into a 501 x 1001 matrix. Now I want to take this matrix from imagesc and put make it into a 3D point cloud. I would like some advice on how to do this. (I am unable to insert the file here even as a .zip file, I can email it to you if you think you can help).

回答 (2 件)

Rik
Rik 2020 年 2 月 19 日
編集済み: Rik 2020 年 2 月 19 日
You can generate the coordinates with ndgrid and then you can linearize the three matrices and use them as input to plot3.
I=randi(255,501,1001);
[X,Y]=ndgrid(1:size(I,1),1:size(I,2));
plot3(X(:),Y(:),I(:),'.')
(untested code)
  5 件のコメント
Sushmitha Kudari
Sushmitha Kudari 2020 年 2 月 22 日
I need to create a 3D point cloud of the logged = log(squished) . For this i need only its x and y components. So for example if this is my x and y:
X Y
1 1
1 8
2 8
5 6
2 5
I want to add a z-component to each so that I can plot it 3D space:
X Y Z
1 1 0
1 1 1
1 1 2
1 1 3
...
1 8 0
1 8 1
1 8 2
...
and so on
Rik
Rik 2020 年 2 月 23 日
If you don't treat the pixel value as the z value, how are you using your data at all?

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


Sushmitha Kudari
Sushmitha Kudari 2020 年 2 月 21 日
I am trying to replicate this model (without the animation) using x and y from the logged. I want to make a 360 degree point cloud model by replicating x and y on different x planes.
%%will plot the formation of ripples on water surface ('_') ->
clear all
clc
x=-50:0.5:50;
y=-50:0.5:50;
[X,Y] = meshgrid(x,y); % create rectangular mesh
R=sqrt(X.^2+Y.^2); %radius
k=0.1; % wave vector
phi=0; % phase
count=1;
for freqrps=0.1:0.1:2*pi
Z=sin((2*pi-freqrps)*k*R);
surf(X,Y,Z,'Facecolor','blue','Edgecolor','none');
axis equal;
camlight right ;
lighting phong;
M(count)=getframe;
count=count+1;
end

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by