how do I generate a random signal with each point being -1 or +1 in MATLAB
1 次查看(过去 30 天)
显示 更早的评论
采纳的回答
Rik
2022-10-21
randi([0 1],1,N)*2-1
That should do it. Or even this:
sign(rand(1,N)-0.5)
Although it is possible that generates a 0 if rand happens to land exactly on 0.5.
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Waveform Generation 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!