LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

sine wave divide by a comlex number

Creating a waveform by using phase shift and amplitude should work.  Its been way too long since I worked with this stuff.  I know the current will lag the voltage with an inductive load, but how do you calculate the phase shift?

 

- tbob

Inventor of the WORM Global
0 Kudos
Message 11 of 23
(1,329 Views)

I just found out, phase shift is arctan(3/4), which comes out to be 0.6435.  This isn't much of a phase shift.

 

- tbob

Inventor of the WORM Global
0 Kudos
Message 12 of 23
(1,320 Views)

 


@tbob wrote:

I just found out, phase shift is arctan(3/4), which comes out to be 0.6435.  This isn't much of a phase shift.

 


That's in radians. Which is about 37 degrees. What do you consider to be a "large" phase shift?

 

0 Kudos
Message 13 of 23
(1,310 Views)

 


@tbob wrote:

Dividing the sine wave by a complex number in Labview may not be what you want.  The way Labview handles it, it treats the waveform as an array of data points.  It does not take into account any phase shifting.  So without phase shift, and dividing each data point by the complex number, you will get a collection of data points as shown in the graph.  At max amplitude of 10, 10+0j divided by 4+3j will give 1.6+1.2j.  I would not know how to divide an enitre waveform by one complex number.  What does this gain anyway?


It's perfectly reasonable to divide a waveform by a complex number. However, the fundamental issue here is that the waveform generation VIs do not generate complex waveforms (i.e., waveforms in which the Y values are complex numbers). It's true that you can configure the waveform generation VIs to give you a phase shift, but that's not quite the same thing. You'd have to assembly the waveform yourself using an array of Y values that are complex. If you do that, then the math works out fine. So, using your example:

 

As I noted before, using a waveform graph for complex values won't tell you anything, as it can't plot complex values. You either have to separate the real and imaginary and plot them as separate plots, or you have to use an XY graph (though that won't show you pretty sine waves). Or, if you're dealing with sinusoids you could convert the complex number back into a sine wave with a specific phase shift, like the waveforms that the waveform generation VIs create. That would involve some programming, though.

0 Kudos
Message 14 of 23
(1,296 Views)

@smercurio_fc wrote:

 


@tbob wrote:

I just found out, phase shift is arctan(3/4), which comes out to be 0.6435.  This isn't much of a phase shift.

 


That's in radians. Which is about 37 degrees. What do you consider to be a "large" phase shift?

 


Its been way too long since I dealt with complex numbers.  Smiley Wink

 

Smerc:  In your last post, you showed the amplitude to be 1.6.  This is the same value I got when I re-created the OP's vi.  But he claims the value should be 2.  I don't see how.

 

- tbob

Inventor of the WORM Global
0 Kudos
Message 15 of 23
(1,277 Views)

 


@tbob wrote:

Smerc:  In your last post, you showed the amplitude to be 1.6.  This is the same value I got when I re-created the OP's vi.  But he claims the value should be 2.  I don't see how.

 


Neither do I.

 

0 Kudos
Message 16 of 23
(1,268 Views)

 


@smercurio_fc wrote:

 


@tbob wrote:

Smerc:  In your last post, you showed the amplitude to be 1.6.  This is the same value I got when I re-created the OP's vi.  But he claims the value should be 2.  I don't see how.

 


Neither do I.

 


The Real part is 1.6, the imaginary part is -1.2.  The amplitude is sqrt[(1.6)^2+(-1.2)^2]=2.  By inspection, the orginal imaginary number (4+3i) forms a 3,4,5 triangle, so the amplitude is 10/5 or 2.

 

0 Kudos
Message 17 of 23
(1,263 Views)

I need to read more carefully. I thought he was asking about the real part being 2 instead of 1.6.

 

Regardless, the bottom line is that LabVIEW is performing the math correctly, which is part of what was being asked.

0 Kudos
Message 18 of 23
(1,256 Views)

 


smercurio_fc wrote:

 

Regardless, the bottom line is that LabVIEW is performing the math correctly, which is part of what was being asked.


 

My current rule of thumb when LV gives unexpected math* results:

90% Pilot Error

9.999% Floating point shenanigans (been a while....knock on wood)

Remainder is LV bugs.

 

The top two values change with time, the remainder is fortunately constant, and merely an upper bound.

 

*Built-in functions on unitless values.  Add units and use Evaluation VIs at your own peril.

 

0 Kudos
Message 19 of 23
(1,248 Views)

@Darin.K wrote:

 


The Real part is 1.6, the imaginary part is -1.2.  The amplitude is sqrt[(1.6)^2+(-1.2)^2]=2.  By inspection, the orginal imaginary number (4+3i) forms a 3,4,5 triangle, so the amplitude is 10/5 or 2.

 


Its slowly starting to come back to me now.  It has been over 20 years since I did complex number math.  For some reason I was thinking amplitude and phase angle.  Totally off target.  Amplitude is gotten from Pythagoreum theory and phase is from arctangent.  WOW its been a long time.

 

- tbob

Inventor of the WORM Global
0 Kudos
Message 20 of 23
(1,242 Views)