Hi..i'm a beginner in using Matlab. I'm currently trying to generate a Gaussian random numbers, then use it as an input to a low pass filter, cut-off frequency 1000Hz. I have the random number generated as: : f = randn(1000,1) * sqrt(2) + 0; I'd like to ask how can i proceed from here to calculate and plot the autocorrelation and power spectrum at input/output of the filter.

 채택된 답변

Wayne King
Wayne King 2013년 12월 15일

0 개 추천

If you have the Signal Processing Toolbox, simply use xcorr() and periodogram()
x = sqrt(2)*randn(1000,1);
Numlags = 50;
[xc,lags] = xcorr(x,Numlags,'coeff');
stem(lags(51:end),xc(51:end))
% power spectrum
Fs = 1; % sampling frequency
[Pxx,F] = periodogram(x,[],length(x),Fs);
figure;
plot(F,10*log10(Pxx))

댓글 수: 4

Aik Hong
Aik Hong 2013년 12월 16일
Thanks a lot ya~ Let me try it out then.
Aik Hong
Aik Hong 2013년 12월 16일
Hi Wayne, btw, how can i implement this to a filter? example if i want to use the random number to a low pass filter with 1000Hz cutoff freq?
Wayne King
Wayne King 2013년 12월 16일
You need more information than that. You need to know minimally the sampling frequency.
Aik Hong
Aik Hong 2013년 12월 16일
Oh ok. I've previously designed (in fdatool) the filter as the IIR Butterworth filter, sampling frequency 8000Hz and cutoff frequency 1000Hz. I've exported the filter to workspace.Can you advice me how should i use the random number generated as input to this filter and then plot its output autocorrelation and power spectrum?

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Wayne King
Wayne King 2013년 12월 16일

1 개 추천

It depends on what you have exported. If you exported a filter object -- I'll assume this.
Let Hd be your filter object
x = randn(1000,1); % white noise input 1,000 samples in length
y = filter(Hd,x);

댓글 수: 1

Aik Hong
Aik Hong 2013년 12월 16일
Thanks a lot. I got my output for autocorrelation and power spectrum like this:

댓글을 달려면 로그인하십시오.

카테고리

질문:

2013년 12월 15일

댓글:

2013년 12월 16일

Community Treasure Hunt

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

Start Hunting!

Translated by