필터 지우기
필터 지우기

get y values of z values in spectrogram

조회 수: 3 (최근 30일)
Freeplot
Freeplot 2020년 4월 10일
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')
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

답변 (0개)

카테고리

Help CenterFile Exchange에서 AI for Signals에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by