How to create the time-frequency spectrogram of FSK

6 views (last 30 days)
Hello....I'm new in this domain and i need some help...I had to generate a fsk signal and now I must do the spectrogram of that signal and I don'n know how...I understood that spectrogram is the function but I don't know how to implement it... here's the code:
N=1000; %numarul de esantioane
D=40; %durata unui simbol(in esantioane)
fc=0.05; %frecventa centrala pentru FSK
M=2; %numarul de stari
t=[0:N-1]';
nr_symb=ceil(N/D);
fd=.0125; %deplasarea in frecventa
depart=fc-(M/2-.5)*fd;
aux=depart+fd*floor(M*rand(nr_symb,1));
mod=kron(aux,ones(D,1));
mod=mod(1:N); %semnalul modulator
signal=cos(2*pi*mod.*t); %semnalul modulat (FSK binar)
figure(...
'units','normalized',...
'position',[.25 .5 .5 .35],...
'Name','Figura 1 - Semnal FSK binar',...
'NumberTitle','off');
subplot(311);
mod1=round(2*(mod-fc)/fd);
plot(mod1,'black');
axis([0 N min(mod1)-.2 max(mod1)+.2]);
set(gca,'box','off')
subplot(312);
plot(signal,'black');
axis([0 N min(signal)-.2 max(signal)+.2]);
set(gca,'box','off')
subplot(313);
densite=abs(fft(signal));
aux=densite(1:N/2);
densite(1:N/2)=densite(N/2+1:N);
densite(N/2+1:N)=aux;
densite=densite(401:600);
f=linspace(-.1,.1,200);
plot(f,densite,'black');
set(gca,'box','off');

Answers (1)

William
William on 6 Jan 2012
there is a library called "voicebox" full of functions for this kind of thing. it's free and I believe there is a spectrogram fucntion within it's contents

Categories

Find more on Time-Frequency Analysis in Help Center and File Exchange

Products

Community Treasure Hunt

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

Start Hunting!