LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Sinusoidal Signal Generator

Hi everyone,
I want to make a program in LabView, in which the output from the VI will be of the type Analogue Waveform and be capable of being displayed on an appropriate Waveform Graph. The Analogue waveform will represent a continuously adjustable sinusoidal function.
The inputs to the VI will perform the following functions:

1) Set the frequency (1Hz to 1KHz). Default 1 Hz.
2) Set the Phase Shift (-180 to 180). Default 0.
3) Set the Amplitude (0 to 20). Default 1.
4) Set the Offset (-5 to 5). Default 0.
5) Set the number of samples per cycle (20 to 1000). Default 100.
6) Set the number of waves (1 to 50). Default 1
7) Set the start time t0. Default 0.

I want to use Sine trig function.

I would greatly appreciate any advice or hint that would help me doing this program.

Thank you,
pontios
symeona@lsbu.ac.uk
0 Kudos
Message 1 of 7
(4,676 Views)
I guess you are using LabVIEW 6 ?
Otherwise, LV 7.x has a shipping Express.vi that do exactly what you are looking for, in the Analyse/Waveform generation subpalette.
CC
Chilly Charly    (aka CC)
0 Kudos
Message 2 of 7
(4,667 Views)
I am using LAbView 7 Express Student Edition.
If you mean the 'Simulate signal', that solves my problem partially. The point is that I want to control my inputs during the execution of the programm and not by configuring them from the options panel. As I saw, 'Simulate signal' accepts inputs only for frequency, amplitude, offset and phase. What about the number of samples per cycle, number of waves, start time?

Thank you,
pontios
symeona@lsbu.ac.uk
0 Kudos
Message 3 of 7
(4,653 Views)
You'll have to modify slightly the express vi :
right click on the icon on the diagram, then select "open front panel". Answer "convert" in the dialog box that shows up. The "simulate Signal" front panel appears. Go to the diagram and locate the Sampling rate and # of samples constants (center of the diagram). Right click on each, and select "Change to Control".
You are done...

CC
Chilly Charly    (aka CC)
0 Kudos
Message 4 of 7
(4,646 Views)
You are right, that should be enough efficient to solve my problem. Though, as I am a novice in LabVIEW this is too much for me!
Since this program is for my assignment (I am student), it has to be very simple, having only the most necessary functions.
The program has to be based on the program below.

Thank you for your help anyway,
pontios
symeona@lsbu.ac.uk
0 Kudos
Message 5 of 7
(4,621 Views)
OK. So you need help, but YOU have to write the program.
Let's do that in several steps.
1/ analyse the example program given. It is a rather poor triangular curve generator. I say poor because it only generates the max and min points, and the rest is simply interpolated. There should be additionnal points in between, if the plot has to be generated using an IO card for instance.
The only reusable things here are :
1a/ the idea of using a loop that runs the proper number of times to generate an array of Y data
1b/ the setup of the waveform from the Y array.

2/ the only thing to be done is therefore to generate a table of Y values that correspond to the equation y = amplitude . sin(t/(2.PI.frequency) + phase)+ offset
That should be straight forward, using the basic math functions. If not, I'm afraid that you'll have to do some personnal preliminar work. There are a number of tutorials available around. See for instance http://cnx.rice.edu/content/col10241/latest/
The only tricky part here is to generate the t values.
There are two possible solution :
2a/generate one t value and calculate the corresponding y. Put everything in the loop to generate the Y array
2b/ generate an array of t values, and calculate the corresponding Y array.

Solution b is better because it allows to replace easily the function, without being obliged to dig into the diagram. And since the mathematical functions in LabVIEW are mostly polymorphics (they accept either single values as input as well as arrays...), it is as easy to calculate the sin of the t array.

Accordingly, you should use the loop to create a t array. Remove the stuff inside the loop, use delta t time (required in the build waveform) and multiply it by the loop index. That's all.

Hope this helps. Good luck

CC
Chilly Charly    (aka CC)
0 Kudos
Message 6 of 7
(4,599 Views)
Sorry for bothering you again.
I couldn't solve the problem with the t parameter.
I made a simple program but I think it needs more work.
Namely, I think I need to set the number of samples per cycle and the number of waves.
Please tell me your opinion.

Thank you,
symeona@lsbu.ac.uk
0 Kudos
Message 7 of 7
(4,554 Views)