# How to get the Z-Axis of power spectrogram?

3 vues (au cours des 30 derniers jours)
Sania Gul le 9 Déc 2022
Commenté : Star Strider le 9 Déc 2022
I want to get the Z-axis of spectrogram stored in a matrix. I can see the X,Y and Z values, whenever I put the cursor anywhere on the spectrogram. But How can I get the Z values for the whole spectrogram in a matrix?
##### 0 commentairesAfficher -2 commentaires plus anciensMasquer -2 commentaires plus anciens

Connectez-vous pour commenter.

### Réponse acceptée

Star Strider le 9 Déc 2022
To see it in 3D, use the view function and choose an appropriate azimuth and elevation. (It was a surf plot in earlier releases, so this would be straightforward. It now requires outputs and a separate surf call.)
An example from the documentation —
fs = 1000;
t = 0:1/fs:2-1/fs;
figure
spectrogram(y,100,80,100,fs,'yaxis')
colormap(turbo)
[sx,fx,tx] = spectrogram(y,100,80,100,fs,'yaxis'); % Call 'spectrogram' With Outputs
Ax = gca;
xlbl = Ax.XLabel.String;
ylbl = Ax.YLabel.String;
hcb = findobj(gcf, 'Type','colorbar');
cbstr = hcb.Label.String;
figure
surf(tx,fx,mag2db(abs(sx)), 'EdgeColor','none') % Plot Wioth 'surf'
colormap(turbo)
hcb2 = colorbar;
hcb2.Label.String = cbstr;
view(-30,60) % Set Camera Azimuth & Elevation
xlabel(xlbl)
ylabel(ylbl)
.
##### 2 commentairesAfficher AucuneMasquer Aucune
Sania Gul le 9 Déc 2022
Thnks s lot 😊
Star Strider le 9 Déc 2022
As always, my pleasure!

Connectez-vous pour commenter.

### Catégories

En savoir plus sur Time-Frequency Analysis 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