Borrar filtros
Borrar filtros

spectogram and frequency spectrum values problem

1 visualización (últimos 30 días)
MARKOS DERMITZAKIS
MARKOS DERMITZAKIS el 11 de Nov. de 2015
Editada: MARKOS DERMITZAKIS el 11 de Nov. de 2015
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)

Respuestas (0)

Categorías

Más información sobre Spectral Measurements 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