Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations cowski on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Random pulse width square wave

Status
Not open for further replies.

Sa-Ro

Mechanical
Jul 15, 2019
279
I would like to create random pulse width square wave as follows:

ON time: 0.0 to 3.0 Milli second

OFF time: 0.1 to 10.0 Milli second

Voltage 5 VDC

Number of cycle: Continuous

Random pulse width square waves to be created from above conditions and save as CSV format to use as arbitrary waveform.

Example:

ON time--------OFF time
---1.1------------3.4
---0.5------------8.6
---2.8------------0.5
---1.6------------7.2
---2.2------------1.7

I have Tektronix AFG31000 series function generator and Tektronix MSO 4 series oscilloscope.

Any recommendations to create in MS Excel, AFG, MSO or online?

Thanks in advance
 
Replies continue below

Recommended for you

It gives only random numbers. Not able to create square wave.
 
Yes. Agreed.

But the time has to increase step by step.

100 us---0
200 us---0
300 us---5
400 us---5
500 us---0
600 us---5
700 7s---0

And so on...
 
I got one idea from last post. Tomorrow I will check and confirm.
 
Huh? You just use the stream of random numbers as the pulse durations and the time accumulates from that. If you need to limit the resolution to 100 us, you just round or truncate as needed.

TTFN (ta ta for now)
I can do absolutely anything. I'm an expert! faq731-376 forum1529 Entire Forum list
 
I got the solution to create random square wave in excel.

Column A as time - Milli second (ms)

Column B as ON time with random number (randbetween)

Repeat the rows equal to ON time.

Ex: for random number 1 to 5

Say 3, hence ON time is 3 ms
Repeat three consecutive rows.

Column C as ON / OFF
If random number is changed, the column C value is changed from OFF to ON or vice versa

Column D as Voltage level
If column C value as ON, then column D value as 24

If column C value as OFF, then column D value as 0

This will create random square wave.
 
That looks pretty horrible to me even if it works, (I suspect it won't)- since it relies on manually copying the rows.



Cheers

Greg Locock


New here? Try reading these, they might help FAQ731-376
 
Geeze, now you want a column with a constant time step?

I didn't try to follow your explanation because it seemed way too convoluted.




 
Status
Not open for further replies.

Part and Inventory Search

Sponsor