LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Waveform graph problem with X scale

Solved!
Go to solution

Hello all,

 

I am using "basic function generator" in order to obtain a sin wave. I plot it in a Waveform Graph, but it only appears till second 1. I am attaching the file. Where is the problem?

 

Thanks in advance

0 Kudos
Message 1 of 12
(1,135 Views)

a previous version if problem

0 Kudos
Message 2 of 12
(1,132 Views)

The default "sampling info" is 1000 points. Once you create a diagram constant (or control) for it, you can change it.

 

altenbach_0-1699485357163.png

 

Also

  • why is your while loop so gigantic???
  • Why do you have blue diagram constants for orange calculations?
  • Why do you generate 128 random numbers to only keep one?
0 Kudos
Message 3 of 12
(1,124 Views)

Hello,

 

thanks for response!!

 

Coud I set sampling info i function of time of code execute? I mean, generating points in real time.

 

Also

  • why is your while loop so gigantic??? I delete the rest of the code, in order to show you just the problem.
  • Why do you have blue diagram constants for orange calculations? I started using LabView 4 days ago and I have to learn on my own... So, I am really really newbie at this
  • Why do you generate 128 random numbers to only keep one? The idea is generating random numbers with a gaussian distribution, which mean is 230 * sqrt(2). I do not know how that block is doing that. I am looking for tutorials and I saw that way.

Thanks in advance

0 Kudos
Message 4 of 12
(1,076 Views)

Words such as "real time" have a very special meaning and I don't think that's what you mean (see also). can you explain exactly what you want to do?

 

Inputs to a function or subVI is just data and it does not care if it is from a diagram constant, from a control that can be changed by the user during a run, or from a result of a calculation.

 

 A top-level while loop should typically not exceed the size of your monitor, else you are doing something wrong. Keep the code simple a modular and wrap relevant chunks into reusable subVIs.

 

Whenever you see a red coercion dot, it means that there is a mismatch in datatype and sometimes (not always!) it is better to fix it. For example, you could right-click...representation and pick something better for your constants. That sqrt and multiplication also needs to be done only once, so it belongs before the loop (Yes, the LabVIEW compiler is smart enough to treat it as such (constant folding, loop invariant code movement, etc) but code is easier to understand and debug if it shows the intent on the diagram.

 

Most inputs of functions have defaults and if you forget to wire them, that's what is being used. If you would set the "samples" input  to 1, you would get an array with only one random point. The help explains that the default is 128 points. Of course you can also generate a random number with Gaussian distribution by using two dices and the Box Muller transform,

0 Kudos
Message 5 of 12
(1,049 Views)

Hello,

 

I will try to explain "real time" meaning on my best (I am not native). I would like to generate all points and plot them in the graph while time (X axis) is in progress (second 1, second 2, ... till stop code). In addition, the amplitude of the full wave is always de same, I mean, the first cicle of the wave has 230 of amplitude and the rest of the cycle have 230 of amplitude too. I would like to see first cicle with 228 of amplitude, second cicle with 231 (in function of random numbers generated)

0 Kudos
Message 6 of 12
(1,043 Views)

What is a "cycle"? One wave (i.e. corresponding to 360 degrees)? You can adjust the sampling frequency, timing, # of points, etc. to get exactly that.

 

If only the amplitude ever changes, you can also generate one normalize wave once, then just multiply it with the current random number.

 

So you you want to generate and append to an ever-growing array of data (until you run out of memory) or just chart the data? How long is the final dataset? Do you want to plot it one point at a time or one cycle at a time?

0 Kudos
Message 7 of 12
(1,036 Views)

I am attaching a photo. You coud see different amplitude values of the signal. I woud l like to plot generated random numbers in that way, because they all represent different levels of amplitude of the signal.

0 Kudos
Message 8 of 12
(1,032 Views)

@Renkor92 wrote:

You coud see different amplitude values of the signal.


Sorry, I cannot see that. You have a repeating cycle of several harmonics of some fundamental period (outlined in green), but each repeat has very similar amplitude.

0 Kudos
Message 9 of 12
(1,026 Views)

I mean this:

 

Labview generates the first random number (for example 243,1). Then, that value will be the amplitude of the funtion generator and it is shown in the graph, but the full sin signal has the same amplitude (243,1).

 

Labview generates the second random number (for example 600). Then, that value will be the amplitude of the funtion generator and it is shown in the graph, but the full sin signal has the same amplitude (600).

 

I would like to see 243,1 amplitude and, immediately, 600 value amplitude at once in the same graph of the sin signal at once.

0 Kudos
Message 10 of 12
(1,007 Views)