Borrar filtros
Borrar filtros

get y values of z values in spectrogram

3 visualizaciones (últimos 30 días)
Freeplot
Freeplot el 10 de Abr. de 2020
Hii there. I want to get the y-values for specific z-values from a spectrogram. I just want to get the y-values for (z > -10).
This is my code for plot the spectrogram:
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% load a signal
[x, fs] = audioread('file.wav'); % load an audio file
x = x(:, 1); % get the first channel
% determine the signal parameters
xlen = length(x); % signal length
t = (0:xlen-1)/fs; % time vector
% analysis parameters
wlen = 1024; % window length (recomended to be power of 2)
nfft = 4*wlen; % number of fft points (recomended to be power of 2)
hop = wlen/4; % hop size
TimeRes = wlen/fs; % time resulution of the analysis (i.e., window duration), s
FreqRes = 2*fs/wlen; % frequency resolution of the analysis (using Hanning window), Hz
% time-frequency grid parameters
TimeResGrid = hop/fs; % time resolution of the grid, s
FreqResGrid = fs/nfft; % frequency resolution of the grid, Hz
% perform STFT
w1 = hanning(wlen, 'periodic');
[~, fS, tS, PSD] = spectrogram(x, w1, wlen-hop, nfft, fs);
Samp = 20*log10(sqrt(PSD.*enbw(w1, fs))*sqrt(2));
% plot the spectrogram
figure;
surf(tS, fS, Samp);
shading interp;
axis tight;
box on;
set(gca, 'FontName', 'Times New Roman', 'FontSize', 12);
ylim([0 1500]);
xlim([0 2]);
xlabel('Time, s');
ylabel('Frequency, Hz');
title('Unterarm Messung Ruhepuls');
view(0, 90);
colormap('jet');
hcol = colorbar;
set(hcol, 'FontName', 'Times New Roman', 'FontSize', 12)
ylabel(hcol, 'Magnitude, dB')
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

Respuestas (0)

Categorías

Más información sobre AI for Signals en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by