フィルターのクリア

How to plot this signal?

2 ビュー (過去 30 日間)
Negar
Negar 2011 年 2 月 20 日
Hi everyone, Can anybody tell me how to define this function and plot it in Matlab?
X(n) = X(n-1)+ 0.9 e(n)
where e(n) is a white,gaussian noise signal, and X(n) is a stationary, gaussian AR(1) process
  1 件のコメント
Negar
Negar 2011 年 2 月 20 日
Sorry Zohar but can you explain to me what you mean by 'not using first element' ? And why did you start n from 2 , and not from 1 ? I am not good at MATLAB at all ...

サインインしてコメントする。

採用された回答

zohar
zohar 2011 年 2 月 20 日
Hi Negar
l = 1000;% length of the signal
x = zeros(l,1);
Noise = 0.9*randn(l,1); % not using first element
% not using first element
% assuming x(0) = 0 or somthing else
for n = 2: length(x)
x(n) = x(n-1)+ Noise(n);
end
% or you can use
x (2:length(x)) = x (1:length(x)-1) + Noise(2:length(x));
plot(1:l,x)
I hope it's help you.

その他の回答 (6 件)

Negar
Negar 2011 年 2 月 20 日
Thank U a lot Zohar, I'll try it..

Negar
Negar 2011 年 2 月 20 日
Sorry but can you explain to me what you mean by 'not using first element' ? And why did you start n from 2 , and not from 1 ? I am not good at MATLAB at all ...

zohar
zohar 2011 年 2 月 20 日
Hi Negar
l = 1000;% length of the signal
x = zeros(l,1);
Noise = 0.9*randn(l,1);
% sorry I meant the first element of x, x(1) not x(0)
%assuming x(1) = 0 or somthing else
for n = 2: length(x)
x(n) = x(n-1)+ Noise(n);
end
% or you can use
x (2:length(x)) = x(1:length(x)-1) + Noise(2:length(x));
plot(1:l,x)
I start with n=2 because x(1) allready defined 0.

Negar
Negar 2011 年 2 月 20 日
Thank you so much Zohar , it really helped :)))))
Now , I have another question, how to find power spectral density of x(n)? I have made this code:
clc close all clear all
ro=0.9; % The nearest sample correlation l = 1000;% Length of the input signal x(n) x = zeros(l,1); E = randn(l,1); % Gaussian ,white noise signal e(n)
for n = 2: length(x) % Generation of the input signal x(n) = ro*x(n-1)+ sqrt(1-ro^2)*E(n);
end y =xcorr(x,x); % Autocorrelation function for x(n) plot(y); title('Autocorrelation function of input signal');
figure psd_x= psd(x); plot(psd_x); % power spectral density of signal x(n)
Is this a correct way to fin autocorrelation function and psd?
  1 件のコメント
zohar
zohar 2011 年 2 月 21 日
It's looks ok type help psd to figure out more about spectrum.psd.

サインインしてコメントする。


Negar
Negar 2011 年 2 月 20 日
ufffff by the way how did you type your code? I couldn't change the font like yours...

Negar
Negar 2011 年 2 月 20 日
ok I think I found the answer, in order to fin psd, I should take FT of the autocorrelation function... I hope you will correct me if I am not right :)

カテゴリ

Help Center および File ExchangeParametric Spectral Estimation についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by