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 CenterFile Exchange에서 Lighting, Transparency, and Shading에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by