gaussian noise in infinite samples in real time matlab

3 ビュー (過去 30 日間)
Rashi Mehrotra
Rashi Mehrotra 2021 年 7 月 23 日
編集済み: Chunru 2021 年 7 月 26 日
I am running a real time experiment which is always running and will stop if a user will send stop command.
The gaussian noise has to be added for infinite samples till the time user is not stopping the simulation.
How can I add gaussian noise for infinit samples.
  4 件のコメント
dpb
dpb 2021 年 7 月 23 日
編集済み: dpb 2021 年 7 月 23 日
Your Q? is far too imprecise to know of what you're asking for, but simply using randn each time need a new sample is almost surely all that is needed to be done.
The default stream in MATLAB has an approximate periood of 2^19937 - 1 which is a close-enough representation of infinite that will surely outlast the user's attention span. randn uses the same rng stream as does rand
Explain what is the real question here.
Rashi Mehrotra
Rashi Mehrotra 2021 年 7 月 26 日
Th real question is I have to add gaussian noise for every sample of data which is received by the radar unit. This will add gaussian noise for infinite sample and stop whenever the radar stop sending. I hope it is clear now. Should I take the value of N as 2^19937 - 1 or for the infinite samples some other function has o be made.

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

採用された回答

Chunru
Chunru 2021 年 7 月 26 日
編集済み: Chunru 2021 年 7 月 26 日
t = 0;
sigma = 1; % noise rms value
while true
x = cos(2*pi*0.01*t); % received data
x = x + sigma * randn; % add noise
t = t + 1;
end
This way, you will keep adding noise to your received data indefinitely. The random number generator in matlab may repeat after some numbers ( 2^19937 - 1 ). This will be a huge number. If you using a sampling freuency of 1MHz, it may take this number of years :
vpa(sym(2)^19937/(1e6*365.25*24*3600))
ans = 
1.367475599344741884064452149827e+5988
This wil take 10^5988 years (can you imagine how big this number is?) to repeat the random number. So you don't have to worry when the random number will repeat.
Anyway, even if it repeats, it unlikely has any side effect to your simulation.

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeMatrix Indexing についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by