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 ...
How to plot this signal?
2 ビュー (過去 30 日間)
古いコメントを表示
採用された回答
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.
0 件のコメント
その他の回答 (6 件)
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.
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Parametric Spectral Estimation についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!