Measurement Studio for VB6

cancel
Showing results for 
Search instead for 
Did you mean: 

square wave

I have plot the sinusoidal wavw form on the x-y axis

for x = -10 to 10 step .001
y = v/2 * sin (2 * pi * x)


to polt the value v "peake to peak"

but how can i blot the square wave and triangle wave for that value
0 Kudos
Message 1 of 2
(5,791 Views)
Hi Bader,

Strictly speaking this is not a Measurement Studio issue but rather a general programming question but I'll try to answer it as best I can. If there is not a specific function than will generate the triangle and square waveforms, like 'sin' from a sinusoidal waveform, then you'll have to generate them yourself. This can be done by using loop structures where the number of iterations will determine the number of points in the array/waveform. For example, if you wanted to make a square waveform of 100 points you would have a for loop structure which assigns the first 50 elements of the array to v/2 and the second 50 elements to -v/2. This array can then be associated with a time base depending on the frequency you require, i.e. Period you require / number of point in the array = time increments for your time base. (1/1000Hz) / 1000 = 1us - each element in the array represents 1 micro second of the waveform. The same concept can be used for the triangle waveform.

This does require more coding but if VB does not have the function to generate square/triangle waveforms then this is a way to do it.

Hope this helps.
0 Kudos
Message 2 of 2
(5,780 Views)