generating random signal

how do i write a simple matlab code that generates a random signal with amplitude varying from 0 to 200 and has length of 2000??
thanks in advance :)

 采纳的回答

please read about function rand
in your case:
out = 200*rand(2000,1);

更多回答(2 个)

Walter Roberson
Walter Roberson 2011-11-30

1 个投票

rand() returns numbers in the range 0 to 1. You can scale and translate those number as needed. You can tell rand() how many values you want to generate.

类别

在 帮助中心 和 File Exchange 中查找有关 Random Number Generation 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by