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

39 ビュー (過去 30 日間)
Sabella Huang
Sabella Huang 2022 年 7 月 5 日
コメント済み: Sabella Huang 2022 年 7 月 7 日
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

採用された回答

Karim
Karim 2022 年 7 月 5 日
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 件のコメント
Sabella Huang
Sabella Huang 2022 年 7 月 7 日
Thank you for your answer, it is work for me

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

その他の回答 (1 件)

Raghav
Raghav 2022 年 7 月 5 日
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 件のコメント
Sabella Huang
Sabella Huang 2022 年 7 月 7 日
Thank you for your answer, it is work for me

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

カテゴリ

Help Center および File ExchangeCorrelation and Convolution についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by