frequency spectrum using fft function

조회 수: 2 (최근 30일)
enas
enas 2012년 1월 2일
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=20.1,w2=20.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

답변 (1개)

Rick Rosson
Rick Rosson 2012년 1월 3일
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

카테고리

Help CenterFile Exchange에서 Spectral Measurements에 대해 자세히 알아보기

태그

아직 태그를 입력하지 않았습니다.

Community Treasure Hunt

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

Start Hunting!

Translated by