frequency spectrum using fft function
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
is the code is right for a question :
compute the frequency spectrum using fft function (512 points) and generate a 4_by_2 plot such as :
the first column displays the window function in time domain 0<=n<=M-1 , the second column displays the window function in frequency domain with the correct frequency scaling in [0,fs/2].
consider a sinusoidal mixture x(n) given as:
x(n)=A1sin(w1nTs+O1)+A2sin(w2nTs+O2)+v(n)
where A1=0.1,A2=1,w1=2ᴨ0.1,w2=2ᴨ0.15,Ts=1,O1,O2 distributed between [0,2ᴨ],v(n)is a zero-mean white Gaussian noise process of variance Q^2=0.01.
clear,clc,close all
% _ _ signal generation
A1= 0.1; % Amplitude 1
A2= 1; % amplitude 2
w1= 2*pi*0.1; % angular frequency 1
w2= 2*pi*1; % angular frequency 2
Ts= 1; % sampling time
N= 512; % no. of process samples to be generated
K= ; % no. of independent process realization
sgm= ; % standard deviation of the noise
n=repmat([0:N-1].',1,k)
phi1=repmat(rand(1,k)*2*pi,N,1) ; % random phase matrix 1
phi2=repmat(rand(1,k)*2*pi,N,1) ; % random phase matrix 2
x=A1*sin(w1*n*Ts+phi1)+A2*sin(w2*n*Ts+phi2)+sgm*randn(N,k) ; % resulting signal
0 commentaires
Réponses (1)
Rick Rosson
le 3 Jan 2012
It looks like you have a good start. Here are some additional functions that will help complete the assignment:
>> doc fft
>> doc fftshift
>> doc abs
>> doc log10
>> doc rand
>> doc randn
>> doc figure
>> doc subplot
>> doc plot
0 commentaires
Voir également
Catégories
En savoir plus sur Spectral Measurements dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!