LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

can i calculate the max and min amplitude ?

If you want to see why the waveform is not a true sine wave, change the max peak to 1 in your 1st example vi. You will see the distortion. With max at 5 and min at 7, the numbers are too close to easily see the distortion, but look at the zero crossing. You can actually see how the slope changes, distorting the sine wave.
You can specify max and min and convert these values to give amplitude and DC Offset. See the attached vi. I also used the Express VI for sine wave generation. I hope this is what you want.
- tbob

Inventor of the WORM Global
0 Kudos
Message 11 of 20
(1,747 Views)
I'll try to answer your questions.

1) The one that is built from two half cycles is not a true sine wave because it does not fit the mathematical definition of a sine wave. I don't remember the definition at the moment, but you can see from the graph on the sample VI that I posted earlier that it does not match the other waveform that is a true sine wave.

2) There is little difference between the Simulate Signal Express VI and the basic function generator. There is just a nice UI for the Express VI that I find easier to use. You can make changes and see them applied until you have what you are looking for. I think you can send the output directly to the AO Write, but if that does not work, I know that you can convert the
output to what AO Write is expecting.

3) You should get the same peaks, yes.

4) I think you can, yes. You may need to wire out a few more things (frequency for example), but I think it will do what you want.

Hope that this helps,
Bob Young
0 Kudos
Message 12 of 20
(1,747 Views)
Thanks Tbob and Bob young,

well i just now tested and it is working very well.
one thing that in function generator VI i can provide a control for the samples(periods) on the user interface level. but in this simulate signal express VI the samples only can be adjusted by clicking the properties. i want to bring this sample(periods) Control adjustment at the user interface level. because the normal user does not know to enter the properties and adjust the samples(periods) there. is there any way to do that?
one last thing i want to give both of you appreciation stars, but in the comment i dont find these stars. how is it possible?
many thanks and Regards
Hood
0 Kudos
Message 13 of 20
(1,747 Views)
thanks one more question, i would like to ask. if we give the the input amplitude 7 to both of these simulation VIs, then the white sine curve we will get, would it be then equal to the red sine curve and then would it become tru sine or not? i mean just by changing the peak value, so that both become equal, will the white curve become the true sine with also all mathematical charesterstics or not?
thanks
0 Kudos
Message 14 of 20
(1,747 Views)
In the example plus five minus seven, when i set the frequency 2 HZ and send the sine curve to the Osillocope, than i get a smooth sine curve with a very slight delay(it is 90 percent smooth sine) but when i send the decimal value like 1.6HZ. i get a delay between the curves, the sine curve i see on the osilloscope looks like following word document. and on the labview graph connected to the output wire it looks quite ok.it also works fine with integer frequency like 1,2,3,4 Hz and so on. but with floating point(decimal input like 1,6 Hz)the output is not ok. do i need to change some data type for frequency input? i also tried by changing the data type. this happened not only with sine simulate express vi, but also
with function generator VI and with also sine pwttern VI. whenever i used floating point data type and try to send 1.6 HZ or some other frequency with fractional values , i get the same problem please explain what should i do?
Thanks
0 Kudos
Message 15 of 20
(1,747 Views)
Use this example and you won't have that problem. Well, at least I don't see break in the waveform at 1.6 Hz.
- tbob

Inventor of the WORM Global
0 Kudos
Message 16 of 20
(1,747 Views)
Hello
well now it looks better on osilloscope with 1.6 Hz frequeny. but still there is a light delay randomly after 4 or 5 periods. i dont know why? is it possible that due to build array VI that i am using between the output signal and A0 write VI? now some times the output signal on osilloscope look like this following word document. it looks like on osilloscope that somebody connected two different sines. this kind of delay is not permitted, because i have to smoothly provide the voltage, because i am controlling a cylinder from this sine wave. if such delay comes in between then this cylinder will take jerks.moreover i am also sending the Vi where i am using the build array VI between the
signal and AO write.
thanks
Download All
0 Kudos
Message 17 of 20
(1,747 Views)
moreover with 5 max and -7 min the signal begin at 0(origin), but at 7 max and -7 min the signal begin at 1. it seems that for every max and min value i have to move phase angle and Change the DC offset. and this i dont want to move the phase angle and change the Dc offset for every max and every min value.
thanks
0 Kudos
Message 18 of 20
(1,747 Views)
The delay after 4 or 5 periods may have something to do with the timer value in your loop. You have it set for 100 milliseconds. Maybe the CPU needs more time to do other functions so it interrupts your vi. Try increasing or maybe even decreasing the value, try from 50 to 500 and look at the effects. Choose the best value.
If you change the max and min, you will have to choose a different phase angle and DC Offset. The vi that I sent you automatically calculates the DC Offset so you don't have to enter in any new value. If you don't want to have to enter in phase angle, you should come up with a formula to auto calculate it for you, like I did for DC Offset. These values have to chan
ge in order to produce the correct waveform for different min and max values. That's straight physics. The only time DC Offset and phase angle are zero is when your min and max are of equal amplitude (+7 -7, +5 -5, +2 -2, etc.) You could use a case statement. If max is equal to absolute value of min, then use 0. If not equal, use calculated or predetermined values.
- tbob

Inventor of the WORM Global
0 Kudos
Message 19 of 20
(1,747 Views)
Dear Tbob, I use all time values between 50 and 500, but all the time i have delay.
i am not getting the required output. i think may be this vis like sine pattern or sine simulator are not the suitable vis. may be there is some other software gives solution of my problem.
any way thanks for your reply.
regards
0 Kudos
Message 20 of 20
(1,747 Views)