dimarts, 15 de maig del 2012

Chirp generation on Matlab

Les següents línies de codi generen una chirp des que fa un escombrat de freqüència des de freq_inicial (Hz) fins a freq_final (Hz) i dura els segons que li posem a duration.
--
The following code generates a chirp from freq_inicial (Hz) to freq_final (Hz). The length of the signal in seconds is defined by duration.

 %PARAMETERS DEFINITION
fs=44100;
duration=5;
freq_inicial=0;
freq_final=22000;

 %CHIRP GENERATION
t=0:1/fs:(duration-1/fs);
y=chirp(t,freq_inicial,duration,freq_final);

 %FREQUENCE REPRESENTATION 
N=length(y);
a=abs(fft(y,N));
increment=1/N;
F=0:increment:1-increment;
f=F*fs; figure;
plot(f,a);

2 comentaris:

  1. Com m'agrada que pengis aquestes coses.
    Com a perepunyetes que sóc: al títol hi has posat sinc!

    ResponElimina