how can i generate random spikes of magnitude 1 and 0 (digital pulses)in matlab

조회 수: 5 (최근 30일)
how can i generate random spikes of magnitude 1 and 0 (digital pulses)in matlab ?
Please find the attached picture,
I need to generate spikes where i can define rise time and fall time.
It should be digital pulses of magnitudes 0 and 1
kindly help how to write code for it
or any example files, pleas provide the file link

채택된 답변

Image Analyst
Image Analyst 2021년 9월 20일
Use
r = randi([0 1], 1, numElements);
To widen the pulses use movmax().
To control the rise and fall of the pulses, use movmean().
  댓글 수: 3
NN
NN 2021년 9월 20일
>> r = randi([0 1], 1, numelements );
Error using numelements (line 27)
Not enough input arguments.
Do we need to input elements?
Image Analyst
Image Analyst 2021년 9월 20일
Of course. What did you use for the number of elements you want in your random array? How about 10 or 900 or 777777? I have no idea what you need.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Descriptive Statistics에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by