LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

sine wave divide by a comlex number

Hi

As a part of a project I want to divide volatge by a complex impedance (Z) to find out current then plot both current and voltage on the same graph to show the difference in amolitude and phase shift.

I have used these functions but I get odd values and there is no phase shift .The signal comes from a simple wave generator.

Would you please help me to fix this problem.

 

0 Kudos
Message 1 of 23
(4,016 Views)

Hi en99,

 

there are a lot of red dots in your small part of the block diagram - they mark coercions to a different datatype...

Are you sure your waveform graph is plotting complex values?

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 23
(4,010 Views)

Hi thanks for your reply.As u said that is a part of my block diagram.Red dots representing the sine wave gererated by a simple wave generator . I have made a complex number using Re/Im to complex function then I used a simple divide function to divide my signal by the complex number but as I said before the amplitude and phase of the signal after devision are wrong.I am not sure whether this is the right way of divinding a sine wave by a complex number.

For example in this picture.The genrated sine wave is 10sin(wt)  and the complex number is 4+3j ..so the current should be 10/(4+3j) and the amplitude should be 2 and phase shift of -arctg(3/4) but this is what I have got

0 Kudos
Message 3 of 23
(3,998 Views)

Hi en99,

 

I think you didn't understand what I'm trying to say...

 

In your first post there are some red dots at both inputs of the divide function and at the terminal of the graph. Those red dots indicate type coercions!

So even when trying to divide by a complex number it may happen that the complex number is then coerced to some other datatype. Also the graph may only take real DBL inputs and so coerces it's input.

So please check you're really getting complex numbers in the end!

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 4 of 23
(3,985 Views)

How are you generating the sine wave of 10sin(wt)?  That part of your code is not showing.  What frequency are you generating?

 

- tbob

Inventor of the WORM Global
0 Kudos
Message 5 of 23
(3,984 Views)

Sending a complex waveform to a waveform graph doesn't tell you much. You need to separate the real and imaginary parts and create two plots in order for the waveform graph to be meaningful. Alternatively, you could use an XY graph. See attached example.

0 Kudos
Message 6 of 23
(3,971 Views)

@ethen99 wrote:

 

For example in this picture.The genrated sine wave is 10sin(wt)  and the complex number is 4+3j ..so the current should be 10/(4+3j) and the amplitude should be 2 ...


 The amplitude should be 1.6, not 2.  I re-created your vi and got the same results.

 The peak value of the sine wave 10sin(wt) is 10.  In complex form, you could write this as 10 + 0j.  If you divide (10 + 0j) by (4 + 3j) you get:

 

First multiply top and bottom by conjugate:

(10 + 0j)    (4 - 3j)       40 + 0j - 30j - 0j

------------  *  --------   =   -------------------------

(4 + 3j)      (4 - 3j)       16 + 12j - 12j -9j^2  

 

Do all the math and you get (40 - 30j) / 25.  So the amplitude is 40 / 25 which is 1.6.  This is the amplitude shown in the graph.

 

If you divide by 4 + 2j you will get an amplitude of 2.

 

- tbob

Inventor of the WORM Global
0 Kudos
Message 7 of 23
(3,962 Views)

many thanks for your reply  and thob

thob: are u sure because I think if for example u divide 10sin(10t) / (4+3j) the answer will be 2sin(10t - arctg(3/4)) .I expect to get this answer.also if 1.6 is correct there is no phase shift.

GredW: u are right about the red dots .I havnt seen these red dots before this post .I think somthing is wrong there and it is not possible to use a simple / function to divide a signal by complex number.any help on another solution really appericiated.

thob I havnt opened your vi yet.I hope to find the answer there.

 

0 Kudos
Message 8 of 23
(3,956 Views)

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?

 

I didn't attach a vi, but it is the same as yours, and I got the same results.  The coercion dots are there to change the waveform data type to a DBL.  The divide funtion must have a floating point input.  So the Y values of the waveform are extracted and used for the divide, hence the red dot.  Of course, if only the Y values are used, the dt is ignored.  So you are not getting any useful results.

 

 

 

- tbob

Inventor of the WORM Global
0 Kudos
Message 9 of 23
(3,949 Views)

I am designing some exercises for first year students .they supposed to make a three phase delta connected circuit and measure voltage,current and power for 1 phase and 3 phase

In one of the exercises the loads consist of a resistor and inductor ( z is complex number ) so they have to plot both voltage and current on the same graph.This is what I want to do.I see  how labview do the job .do u have any advice for another solution. I was thinking I can first find the phase shift then generate a sin wave by knowing the amplitude and phase of current instead of dividing voltage by impedance

0 Kudos
Message 10 of 23
(3,941 Views)