spectogram and frequency spectrum values problem
조회 수: 3 (최근 30일)
이전 댓글 표시
hello all, I would like some help regarding my problem, which is to write a function that takes as input a one-dimensional waveform (a piano signal for this case), and plot its frequency spectrum and its spectrogram. I am not sure if the values I chose are correct and what to do in order to improve the whole thing.
[y,fs] = audioread('pia60.wav');
%sound(y,fs);
S = size(y); %size of y = 125031
Time = length(y)/fs; %duration of the recording
Time
t = [0:length(y)-1]/fs; %the time axis
plot(t,y); %plot the signal
xlabel('seconds');
grid on;
N = 20000;
y1 = y(60000:80000);
fft_vector = fft(y1,N);
m = abs(fft_vector); %we are interested only in the amplitude
x =(0:999)*Fs/N; %the frequency axis with the first 1000 elements
stem(x, m(1:1000)); %plot the frequency spectrum
xlabel ('Frequency [Hz]');
length(fft(y1,N))
%SPECTOGRAM
window = hann(512); %a window with a size of 512 points
noverlap = 256; %the number of noverlaps
nfft = 20000; %size of nfft
spectrogram(y, window, noverlap, nfft, fs)
댓글 수: 0
답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Filter Analysis에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!