Turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page

03-30-2013 09:47 AM

Options

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report to a Moderator

Hello everyone,

I am a beginner to LabVIEW. I have to make a VI to plot a cycle of sine waveform with amplitude=1V, f=50 Hz and phase=45(in degrees). I have made the attached VI. But this is giving wrong results. I have converted all the values to radians and used while loop as per the question. Please someone have a look at my VI and please tell what is the problem.

I also wish to ask: In each iteration of the while loop, a value is passed to the waveform chart to plot corresponding to the value of t (time) which I have incremented in each iteration by a unit degree(converted to radians) upto 2*(pie) radians. Will the plot on the chart be corresponding to the values of t as per every iteration or the chart will follow the default way of plotting for t=zero and then incrementing by one. How can we control this thing?

Please reply soon.

04-04-2013 12:36 AM - edited 04-04-2013 12:50 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report to a Moderator

@Amitech wrote:

I have converted all the values to radians and used while loop as per the question.

(This part is not related to LabVIEW)

First, it doesn't make sense to convert 't' into radians. Think of the units: A sine wave is represented by *sin(**ωt+**θ)*, where ω is [rad/s], t is [s], and θ is [rad]. So, when multiplying, ω*t is [rad/s * s] = [rad].

In your code, however, *w*t* is [rad/s * rad] = [rad^{2}/s] -- wrong units.

Secondly, remember that in a computer, you're dealing with discrete (sampled) waveforms. Ask yourself:

- What is your sampling frequency? How many samples are there in 1 second?
- What is your sampling period? How many seconds are in between 2 consecutive samples?
- How many samples are there in 1 sine period?

If you're not asked to use a specific sampling frequency, just pick one that's much greater than 50 Hz. (In your case, 1 kHz is a good sampling frequency) Then, answer the 3 questions above and see if it becomes clearer.

@Amitech wrote:

I also wish to ask: In each iteration of the while loop, a value is passed to the waveform chart to plot corresponding to the value of t (time) which I have incremented in each iteration by a unit degree(converted to radians) upto 2*(pie) radians. Will the plot on the chart be corresponding to the values of t as per every iteration or the chart will follow the default way of plotting for t=zero and then incrementing by one. How can we control this thing?

(This part is related to LabVIEW)

Right-click the chart -> Properties -> Scales

If you set the "Multiplier" of the X-axis to your sampling period, the chart will convert the sample-number back to seconds