How to generate noise signal with desired max and min signal?

50 visualizzazioni (ultimi 30 giorni)
Sabella Huang il 5 Lug 2022
Commentato: Sabella Huang il 7 Lug 2022
Hello Guys,
I want to ask about, how to generate noise signal with a desired max and min amplitude?. For example, I want to generate noise signal with max 4 and min 2 just like this figure.
Thank you
0 CommentiMostra -1 commenti meno recentiNascondi -1 commenti meno recenti

Accedi per commentare.

Risposta accettata

Karim il 5 Lug 2022
if you just want a random signal you can try the following:
MinVal = 2 ;
MaxVal = 4;
numPoints = 1000;
Data = MinVal + rand(numPoints,1) .* (MaxVal - MinVal);
figure
plot(Data)
grid on
ylim([0 5])
1 CommentoMostra NessunoNascondi Nessuno
Sabella Huang il 7 Lug 2022
Thank you for your answer, it is work for me

Accedi per commentare.

Più risposte (1)

Raghav il 5 Lug 2022
You can use tha rand() function to get a random noise signal in range of (a,b) by writing the expression: a+(b-a)*rand(size(x)).
x = linspace(0,1000,1000);
plot(2+2*rand(size(x)))
To undesrtand more about the rand() function, read the following documentation:
1 CommentoMostra NessunoNascondi Nessuno
Sabella Huang il 7 Lug 2022
Thank you for your answer, it is work for me

Accedi per commentare.

Categorie

Scopri di più su Multirate Signal Processing in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by