How to add noise in [0 2] interval to an elements of an array randomly?
Show older comments
I have an array that is called 'r1' and i need a white noise to add to elements of the array. Every noise that is gonna to be added to elements should be different (like randomly) in [0,2] interval.
a = 0;
b = 360;
rng('shuffle');
ncycles = 10;
npoints = 500000;
r1 = sort((b-a)*rand(npoints/ncycles,ncycles)+a,1,'ascend');
r1 = r1(:);
3 Comments
Rik
on 12 Apr 2022
Does it have to specifically be white noise? Also, if you're limiting it to [0,2], then (to my limited knowledge) it wouldn't actually be white noise.
What have you tried so far? There is probably already code you could find online that would generate different colors of noise.
Ayberk Ay
on 12 Apr 2022
Ayberk Ay
on 12 Apr 2022
Accepted Answer
More Answers (1)
Christopher McCausland
on 12 Apr 2022
Edited: Christopher McCausland
on 12 Apr 2022
6 Comments
Ayberk Ay
on 12 Apr 2022
Christopher McCausland
on 12 Apr 2022
Hi Ayberk,
If you are using an instatutional licesne you might be able to get the Communications System toolbox from the addon manager.
Christopher
Ayberk Ay
on 12 Apr 2022
Christopher McCausland
on 12 Apr 2022
Hi Ayberk,
This is good work.
Ploting the input vs output gives you this, your output (red) follows the input (yellow) with a potential deviation of 4. Is this what you were looking for? I am not sure if you are only looking this over the first 2 seconds or for a max min of two?
I have shown from x = 0 => x = 1.
Christopher

Ayberk Ay
on 12 Apr 2022
Christopher McCausland
on 12 Apr 2022
No worries,
I am glad to be of help! If you could accept this answer that would be fantastic!
Christopher
Categories
Find more on Propagation and Channel Models in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!