How to Turn Imagesc to x and y?

1 vue (au cours des 30 derniers jours)
Sushmitha Kudari
Sushmitha Kudari le 19 Fév 2020
Commenté : Rik le 23 Fév 2020
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).

Réponses (2)

Rik
Rik le 19 Fév 2020
Modifié(e) : Rik le 19 Fév 2020
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 commentaires
Sushmitha Kudari
Sushmitha Kudari le 22 Fév 2020
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 le 23 Fév 2020
If you don't treat the pixel value as the z value, how are you using your data at all?

Connectez-vous pour commenter.


Sushmitha Kudari
Sushmitha Kudari le 21 Fév 2020
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

Catégories

En savoir plus sur Lighting, Transparency, and Shading dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by