plot_spectre2 - compute and display spectra in graphic window of a temporal wave form with frequency translation
step = plot_spectre2(vart,Tse,Tacqui,Fd,l_win,nwin,flag)
- vart : vector of real. vector of samples in time domain
- Tse : scalar. time sampling step
- scalar. Tacqui : initial time when the analyse begins
- scalar. Fd : target frequency of the spectrum
- integer. l_win : size of the frequential window in sample
- integer. nwin : id of the scilab figure window
- integer. flag : set the plot with a x-axis logarithmic scale
- 0 : x-axis linear scale
- 1 : x-axis logarithmic scale
- scalar. step : the frequential step
/////////////
//
//plot_spectre_2: fonction qui affiche le spectre d'une forme temporelle sous-échantillonnée
// par translation de spectre
//
//Entrées
//vart : vecteur de la forme temporelle de taille (Nsav,1)
//Tse : pas temporel d'echantillonnage
//Tacqui : temps initial au début de l'analyse
//Fd : Fréquence centrale du spectre à observer
//l_win : taille de la fenêtre spectrale désirée (en nbr d'échantillons)
//nwin : numéro de fenêtre
//flag : drapeau échelle logarithmique flag==0 echelle linéaire
// flag==1 échelle logarithmique
//
function [step]=plot_spectre2(vart,Tse,Tacqui,Fd,l_win,nwin,flag)
//Calcul la longueur du vecteur de la forme temporelle
Nsav=size(vart,'*');
//Calcul du pas fréquentiel
step=1/(Nsav*Tse);
//Calcul de la date finale de l'analyse
Tfin=Tacqui+Nsav*Tse;
//Calcul du vecteur temps pour translation
t=Tacqui:Tse:Tfin-Tse;
//Réalise translation
vart_t=vart'.*cos(2*%pi*Fd*t);
//Calcul du spectre (non normalisé)
DSP=10*log10((1/(Nsav)*abs(fftshift(fft(vart_t,-1))))^2)-10*log10(step);
if flag==0
//Calcul du vecteur échantillon
vec=(Nsav-l_win)/2+1:1:(Nsav+l_win)/2;
//Calcul du vecteur fréquentiel
vec_f=(vec-Nsav/2)*step+Fd-step;
//Ouvre la fenetre graphique
scf(nwin);
f=scf(nwin);
f.figure_size=[300,350];
//
plot2d(vec_f,DSP(vec),rect=[min(vec_f),min(DSP(vec)),max(vec_f),max(DSP(vec))+5]);
elseif flag==1
//Calcul du vecteur échantillon
vec=Nsav/2:1:(Nsav-1)-Nsav/2+l_win;
//Calcul du vecteur fréquentiel
vec_f=(vec-Nsav/2)*step;
//Ouvre la fenetre graphique
scf(nwin);
f=scf(nwin);
f.figure_size=[300,350];
//
plot2d("ln",vec_f+2*step,DSP(vec+2),,"011",rect=[step,min(DSP(vec+2)),max(vec_f+2*step),max(DSP(vec+2))]);
end
endfunction
IRCOM Group
Alan Layec