Phase difference analysis question

I know there are a lot of signal processing experts on this board and wish I could get some nice suggestions.
I have a two channel data: one is the load signal like sine wave; the other is the response signal with a pulse in each load cycle. I am going to analyze whether there is phase shift for the pulse to the load signal. Visually it is very straightforward to "measure" the phase between load peak and pulse peak. But it's hard to code it. I believe there are a bunch of better ways for coding easily (I am considering cross-correlation). Since these are high frequency signals, the size of the data set is huge, which makes such processing time-consumming.
Any suggestions? Thanks!!!

I find the answer in the help. Thank you very much! Jay
Extract Single Tone Information 1 Chan.vi
"Takes a signal in, finds the single tone with the highest amplitude or searches a specified frequency range, and returns the single tone frequency, amplitude, and phase. You can use this polymorphic VI to analyze a waveform or an array of waveforms. "

Similar Messages

  • Questions about phase difference (possible timing issue) RC circuit

    Hello,
    Below is the program I am using to measure the phase difference in an RC circuit. Simply put I generate a 2kHz sine wave in LabView and send it to the circuit using an Analog output. Then I measure the output sine wave using an analog output.I also measure this using n oscilliscope. I cna clearly measure the phase difference with the oscilliscope and know it to be approximately 1.4 radians.
    Issues with the program:
    Different phase difference measured each time the program is run for the circuit. It is also never correct.
    Possible causes:
    You will notice by looking at the vi I measure the phase from the signal generator. Should I be using a second analog input to measure the sine wave as it is outputted at the start of the circuit?
    I mainly think that it is a timing issue. While the phase difference is constant each time the program it varies each on run. So the time each tone measurement begins its first measurement seems to be different each time and causes this different phase reading.
    The card I am using is a PCI 6221, is there a timing issue related from switching to input and output acquistion or are they seperate.
    Is there anyway to ensure that both tone measurements are measuring phase at the same point in (actual) time?
    I would really appreciate any advice or alterations on the program anyone could offer me (I am a college student and LabVIEW is not on our curriculum so I have no support, yet I am using it for my project (D'oh!))
    Solved!
    Go to Solution.
    Attachments:
    RC Circuit Test.vi ‏271 KB

    I would certainly acquire two signals.  Feed the analog output right back into an analog input and then your filtered signals in another.
    Initially, I would feed the analog output into both analog inputs and measure the phase delay due to the multiplexed A/D on the card.  Once you have that measurement, you can feed in the filtered signal and then measure the phase difference of that signal.
    Randall Pursley

  • Acquiring phase difference

    So I have acquired to analog signals from a function generator by splitting the output.  So they are more or less the exact same signal.  I am trying to test my program with this setup.  I am using an M-series DAQ card that has a maximum acquitision rate of 250k or 125k per channel (for two channels).  My goal is to find the phase difference of the signal, so for this trial it should be more or less zero.  I have accounted for interchannel delay correctly (I think) but I am still having problems.  When acquiring the phase difference I will get a steady zero, but then periodically it goes to 360 degrees.  So I would like to know if anyone can explain what in my program is causing this. I have attached a picture of the front panel when the 0->360 phase anomoly occurs and also my architecture in general. I'm pretty new to Labview so any help would be appreciated
    Attachments:
    Doc1.docx ‏167 KB
    DAQphaseshift4.vi ‏29 KB

    You are running into phase wrapping.  In your particular case, 0 and 360 are essentially the same.  What is probably happening is your phase is going slightly negative, but is being mapped into positive phase space.  So instead of getting -0.01, you are getting 359.99.  As a simple fix, if you know your phase should always be in the range -50 to 50 (for example), you can subtract 360 from values over 50 and add 360 to values under -50.
    Phase unwrapping can get fairly complex, but should be fairly easy in your case.
    As for your program, it is a fairly decent simple piece of code.  You can remove the flat sequence (right click on the frame of the sequence and choose remove).  It is doing nothing for you.  LabVIEW dataflow already determines the sequence of those items contained within it.
    If you need better performance, you can move your analysis to a different loop and use a producer/consumer architecture, but this is probably not necessary for the one-shot acquisition and analysis you are doing.
    This account is no longer active. Contact ShadesOfGray for current posts and information.

  • Frequency response and phase difference

    Hi,
     I generate "Sine-Swept" with a function generator, which is the input of my device.
    Then, I measure the output(vibration) via a photodiod (which is as voltage).
    Now, I want to obtain FRF and Phase difference between these two wave (output and input).
    In most of the examples, the input and swept has been generated by the software itself, but if the input has been acquired externally and also the swept has been done via a function generator, how would be the FRF?
    I have installed "Sound and vibration toolkit", Could you please give me a heads up, that how can I do that?
    In advance, I really appreciate your help,
    Petar

    Hi,
    I attached the project which I've recorded the data from DUTs. Also, I attached 2 snap-shots of the project, in case of the project file couldn't be launched.
    I have connected the signal from a function generator to "ACH0" channel, and performed the swept-Freq in the output signal of function generator. (Red graph in 1st chart). Please note that the swept sine wave is generated via the function generator itself...NOT VI
    The generated signal by the function generator is the input, which derives the oscillation of a drop,
    A photodiode measures the oscillation of the drop via laser-scattering by drop vibration. SO....the signal generated by the photodiode is the "Response"....(white wave in 1st chart)(connected to "Ach1" channel.
    Now, I want to obtain FRF, which the input is the signal generated by the function generator, and Response is the output of the photodiod'
    As it's seen in the files...the FRF and phase difference is n't what is expected, also the coherence between in and output is zero!
    Please help me out with this problem...
    Thanks
    Petar
    Attachments:
    12.seproj ‏419 KB
    1.JPG ‏183 KB
    2.JPG ‏177 KB

  • Better estimation of phase difference between two signals with variable frequency!

    Hello LabView Gurus, 
    Being a power engineer and having just a little knowledge of signal processing and labview, I have been pulling my hair out for the last couple of days to get a better estimation of phase difference between two signals.
    We have two analog voltage signals; 1. sine wave (50Hz ± 1Hz) and 2. a square wave with exactly half of sine wave frequency at any time.
    At the starting point of operation (and simulation/acquisition) both signals will have no phase difference. However, the square wave's frequency changes unpredictably for a just a few millisecond but then it gets synchronized with sine wave's frequency again. This means that the square wave will be phased out from its original position. The task of the labview is to find the phase difference between the two signals continuously.
    My approach to determine the phase difference is to measure the time when sine wave crosses zero amplitude and the time when the very next square wave changes amplitude from zero volts to +ve voltage (I have a 0.5volts threshold just to avoid any dramas from small line noise). The difference between these times is then divided by the time period and multiplied by 360 to get this phase difference in angles. 
    As this part is just a small block of a big project, I can only allow 5000Hz sampling rate each for both signals. I read 500 samples (which means I read data from 5 cycles of sine wave and 2.5 cycles of square wave).
    Now the problem is, as long as the frequency of sine wave stays constant at exactly 50Hz, I get a good estimation of the phase difference but when the frequency changes even a little (and it will happen in the real scenario i.e 50Hz ± 1Hz  and the square wave's frequency is dependent of sine wave's frequency), the estimation error increases.
    I have attached my labview program. From front panel, you can set the phase of square wave (between -180 and 0) and you should see the labview's calculated phase in the indicator box named 'Phase'. Then you can press 'Real Frequency' switch that would cause the frequency to change like it would in real operation.
    You can observe that the estimation error increases after you push the button. 
    All I need to do is to reduce this estimation error and make it as close to the actual phase difference as possible. Any help would be greatly appreciated.
    I am using LabView 2009 for this task.
    The application is for electric machines and the stability/performance of machines under different faults.
    Thank you for reading this far!
    Regards,
    Awais
    Attachments:
    v603.png ‏320 KB
    v603.vi ‏186 KB

    Jeff Bohrer wrote:
    Basic math gives me a bit of pause on this approach.  You are sampling at 50 times the frequency of interest so you get 50 samples per cycle.  your phase resolution is 1/50th cycle or 7.2 degrees +/- noise.  You will need to samlpe faster to reduce phase resolution or average multiple readings (at a time cost that is signifigant)
    Jeff- (Hardly Working)
    I am sampling at 100 times the sine wave's frequency and 200 times the square wave's frequency.  Increasing the sampling rate completely solves my problem. But since I am acquiring several other inputs, I cannot afford a sampling rate higher than 5kHz.
    F. Schubert wrote:
    I'm not a signal processing expert, but here my basic understanding.
    If you simulate sampling with 5kHz and a frequency of 50 Hz (and both are 'sync' by design), you always get an exact 5 periods. Any variation of your signals frequency gives you a propability to get 4 or 6 'trigger' events. That's an up or down of 20%!
    The one measure to reduce such problems is using 'window functions'. They don't fit your current approach (counting instead of a DSP algorithm), so this needs to be reworked as well.
    My approach would be to use the concept of a Locki-In amplifier. You need to phaseshift your ref-signal by 90°. Then multiply your measurement signal with the ref signal and the phase shifted ref signal. The obtained values for x/y coordinates of a complex number. Calculate the theta of the complex number (with the LV prim). Feed this in a low pass filter.
    The trick on this is, that the square wave has harmonics in it, in this you are interested in the second harmonic which is the sine wave.
    To get rid of the effect that the sync between sampling rate and ref signal frequency gives an error, you then can use the window I mentioned above (place it before the lock-in).
    For a design that really plays well, use a producer-consumer design pattern to get the calculations done in parallel with the DAQ.
    I suggest you to check on wikipedia for some of the keywords I mentioned. Go also for the external links which lead to great tutorials and AppNotes on the signal processing basics.
    Sorry, it's not a simple solution I offer and we will have quite some conversation on this forum if you follow this path. Maybe someone else knows a simpler way.
    Felix
    www.aescusoft.de
    My latest community nugget on producer/consumer design
    My current blog: A journey through uml
    An interesting view. the sine wave can indeed be looked as a second harmonic of the square wave. I will implement your idea and get back to you as soon as I get some results. But since I have very limited knowledge of signal processing, it might take me a while to get my hear around the solution you mentioned.

  • Looking for a VI to calculate phase difference

    I am looking a VI that will calculate the Phase difference as a function of time between two sine waves at 20 kHz. I am using LabView7 Express just so we're on the same page.

    Hi,
    There is a Extract Single Tone Information.vi that is available from All Functions >> Analyze >> Waveform Measurements. This VI takes a time signal in and returns a detected phase (deg) out. Therefore, you can use one of these VIs for each sine wave and take that difference to determine the phase difference of your sine waves as a function of time.
    Note that the Extract Single Tone Information.vi is not available LabVIEW Base package, but is available in all other LabVIEW packages.
    Thanks again and have a great day!
    Kileen C.
    Applications Engineer
    National Instruments

  • How to calculate the phase difference between two square wave (acquired from two channel in one DAQ)

    Hello everyone ,
     I need a quickly help that as below :
    I am trying use PCI-6220 to acquired six signals from one rotation encoder (channel A, channel B,channel Z ,and their non-signals) .The encoder out signals will be square wave and 4000pulses per revolution. I set it rotation at 300rpm speed. I need show every square wave of six out channels in waveform and measure the A-B phase difference to check if the value is correct (designed value should be 90deg) .
    I have no idea how to measure or calculate the phase difference of two square wave base on synchronizate to acquire these two square wave from two channel on the PCI-6620....
    Anyone can give a idea how to calculate the phase difference with two square wave ?
    Thank a lot and Thanks again...
    Tim

    Tim,
    Here is a simple rising edge detector for one channel.
    Lynn
    Attachments:
    Rising edge.vi ‏15 KB

  • Measuring Phase Difference of acquired sound input - How to set the reference

    I am trying to measure the phase difference between two audio inputs.(Left and Right Channel of my sound card)
    Both are free running 1kHz audio samples which come in and out of phase.
    When the samples are in phase everything seems to be working correctly and shows no phase difference.
    However once the signals start to go out of phase +-10deg the result keeps jumping around.
    It appears to be the fact that it is changing the reference to determine the phase.
    When I view the output phase of a channel it is a sawtooth waveform moving from 250deg and then wraps round to -110deg
    What I want is to fix one input at 0 degrees and see the others inputs phase difference against it. 
    Is there a way to set one signal as the reference or an alternative strategy?
    Thanks in advance for any assistance. 
    PLEASE NOTE THAT THE acquire.jpg IS ACTUALLY THE VI.
    It would not upload as the vi. Please rename extension to acquire.vi to view it. 
    Message Edited by EuanB on 05-15-2009 01:54 AM
    Message Edited by EuanB on 05-15-2009 01:55 AM
    Message Edited by EuanB on 05-15-2009 01:57 AM
    Message Edited by EuanB on 05-15-2009 01:57 AM
    Message Edited by EuanB on 05-15-2009 01:59 AM
    Solved!
    Go to Solution.
    Attachments:
    In Phase.jpg ‏835 KB
    Out of Phase.jpg ‏857 KB
    acquire.jpg ‏33 KB

    I did some modifications to my first vi. Now is the amplitude problem removed. At least in then I simulate. You may test in real world:smileytongue:
    Besides which, my opinion is that Express VIs Carthage must be destroyed deleted
    (Sorry no Labview "brag list" so far)
    Attachments:
    demo_v2.vi ‏33 KB

  • Measure phase difference between 2 signals

    I am very new to labview. i m trying to use labview to measure phase between 2 signals from encoder. I also want to measure the state of 2 quadrature square signals. anyone has any idea how to do it?

    Hi "rvn10",
    Quadrature encoders do by nature have a phase difference of 90 degrees between channel A and B. This phase difference is required to know in which direction the shaft is rotating when a transition from one of the channels is received. Please see these two links for some useful information:
    Encoders
    Linear and Rotary Encoders
    Quadrature Encoder / Position Measurement
    If your goal is to measure the angular position using the two quadrature square signals, then your task is quite simple if you use one of our Counter/Timer cards. Check for example the shipping example called "Measure Angular Position.vi".
    If you want to read more about our most affordable Counter/Timer product, then check this link:
    NI PCI-6601
    Please let us know if you are using different hardware to acquire the signals.
    - Philip Courtois, Thinkbot Solutions

  • Phase difference

    Hi,
    I'd like to plot phase difference between two signal(input-output), the method which I'm using currently, is taking "FFT" and (r-teta)....and subtracting the phases, but what I obtain isn't so desirable, Do you know anyother option or suggestion to make my results better?
    I've attached the plot and marked them, one of the is "Output FFT- magnitiude vs. Frequency" as you see it's acceptable, but another which is "phase difference vs. freq" isn't so good.
    Thanks
    Petar
    Solved!
    Go to Solution.
    Attachments:
    IMG_0440.JPG ‏140 KB

    Thanks for your replies, I've attached the acquired data..
    (notepad file).1 column: Frequency......2nd column (FRF of output- magnitude)...........3rd column(FRF phase difference(output-input)).
    In the figure: left column: input....FRF magnitude.................right column: output...phase frf....fft of output in every step.
    thanks
    Petar
    Attachments:
    Sweep-read-copy - Copy.vi ‏169 KB
    March30-Monday.docx ‏19 KB
    New Picture (49).jpg ‏571 KB

  • Need Analysis Questions for Procurement

    Hi Experts,
    Where could I find a set of need analysis questions to ask a potential client about their procurement process?
    I am currently running my first need analysis workshop, and would like to know what kind of questions to ask the business so I can find out more about their business processess with regard to procurement.

    >
    Lindsay Gossmann wrote:
    > Hi Experts,
    >
    > Where could I find a set of need analysis questions to ask a potential client about their procurement process?
    >
    > I am currently running my first need analysis workshop, and would like to know what kind of questions to ask the business so I can find out more about their business processess with regard to procurement.
    In general, the analysis should cover the following:
    - Types of procurement departments, since there might be different departments for different kinds of purchases - perhaps different lines of business altogether.
    - Process of procurement of each
    - Centralized / decentralized processing
    - Treatment of taxes / duties
    - Inventory valuation procedures
    - Quality checks during procurement
    - Long term contracts / agreements
    - Treatment of low value items (with or without purchase order)
    - Approval process (release procedure)
    - Stock transfer process across plants
    - Subcontracting / consignment / pipeline requirements
    - Process for vendor returns
    - Scrap generation / storage
    - Physical inventory process / frequency /writeoffs
    - Treatment of freight and other charges
    - Imports, if a different process is followed.
    - Service procurement process
    - Any special process associated with the company or industry.
    Hope this covers most of the business processes related to procurement
    Regards,
    Aroop

  • Phase difference measuremen​t

    I need assistance measuring the phase difference between two digital signals (0 to 5 volts). The signals are angle outputs of a rotating torque sensor. All of this is for the purpose of tracking the angle of rotation as I measure torque. Normally, I would run first angle to a counter and the second angle through an up/down gate on the DAQ board, however my board has no such up/down gate. The two signals are supposed to be 90 degrees out of phase depending on the direction of rotation. As such, Labview should then differentiate when to count up or count down the degrees of rotation. If I had a way of mathematically determining the phase of the signals, I could write a Labview vi to change the counting from one way to the other. I have already spent hours researching phase difference methods on the forums, however I am using Labview 8 base package, and therefore do not have access to advanced functions such as Hilbert Transforms or AC/DC Estimators. Any ideas? There has to be a way to use trig identities or something and solve out phase difference.
    Matthew

    Search for "quadrature encoder" on ni.com. Here is an extract from this link.
    Quadrature Encoders
    The most common type of incremental encoder uses two output channels (A and B) to sense position. Using two code tracks with sectors positioned 90° out of phase, the two output channels of the quadrature encoder indicate both position and direction of rotation. If A leads B, for example, the disk is rotating in a clockwise direction. If B leads A, then the disk is rotating in a counter-clockwise direction. Therefore, by monitoring both the number of pulses and the relative phase of signals A and B, you can track both the position and direction of rotation.
    In addition, some quadrature detectors include a third output channel, called a zero or reference signal, which supplies a single pulse per revolution. This single pulse can be used for precise determination of a reference position.

  • How to find the phase difference between two signals using Hilbert transform

    hi, 
        I am new to LabView.... I am trying to find phase difference between two signals. I sucessfuly found out the phase difference between two predefined waves using single tone measurement. .... But I really want to know how can I measure phase difference between two signals( not predefined... ie we don't know the initial conditions) using hilbert transform or any transformation techniques (without using zero cross detection).. I tried by using hilbert transform based on algorithm... bt I am getting error.... plz help me
    Attachments:
    phase_differece.vi ‏66 KB

    you could try something similar to this, for each table pair that you want to compare:
    SELECT 'TABLE_A has these columns that are not in TABLE_B', DIFF.*
      FROM (
            SELECT  COLUMN_NAME, DATA_TYPE, DATA_LENGTH
              FROM all_tab_columns
             WHERE table_name = 'TABLE_A'
             MINUS
            SELECT COLUMN_NAME, DATA_TYPE, DATA_LENGTH
              FROM all_tab_columns
             WHERE table_name = 'TABLE_B'
          ) DIFF
    UNION
    SELECT 'TABLE_B has these columns that are not in TABLE_A', DIFF.*
      FROM (
            SELECT COLUMN_NAME, DATA_TYPE, DATA_LENGTH
              FROM all_tab_columns
             WHERE table_name = 'TABLE_B'
             MINUS
            SELECT COLUMN_NAME, DATA_TYPE, DATA_LENGTH
              FROM all_tab_columns
             WHERE table_name = 'TABLE_A'
          ) DIFF;that's assuming, column_name, data_type and data_length are all you want to compare on.

  • Phase Difference and manipulate it

    Hello,
    my english is bad, so I post an example;-)
    However I try to explain: I build the Phase Differenz of two Signals an then I want to manipulate one of them, so that there is no Phase Difference after that. In the example I use simulated Sinus-Signals. Normally I acquire analog Signals with the PCI-6143 (simultaneous sampled).
    Can anybody help me? In my Application with the DAQ the phase difference is display correct. In the example nothing works....
    Gruß, tosi
    Attachments:
    BeispielPhase.vi ‏268 KB

    Boquel,
    Hey!  I noticed that this post is about two years old.  You may want to create a new post that references this one.  That way, you may have more of a chance for the community to see it.  You may want to ask if anyone knows how to find the difference in phase between two signals.  I believe you compute the phase for each signal, then subtract.  This is probably what is happening in the subVI and you will most likely have to write that code.
    Hope this helps!
    Dan
    Daniel Eaton
    National Instruments
    Systems Engineering
    Embedded and Industrial Control

  • Phase difference from 2 signals(HELP!)

     Hi! I'm having trouble finding accurate phase difference between two signals.. one signal is from the input serial communication arduino and the second signal is a simulated signal. I want to find the phase difference between these two. I've googled a lot and found many similar threads of phase difference measurements, but it won't work.
    The phase angle from the simulated signal is correct but the reading of the phase angle from the input signal keeps changing and I could not find an exact phase angle or phase difference.
    What do you think I should do?

    Doing phase difference measurements using two completely separate sets of hardware is in general a bad idea. You need to think carefully about how to synchronize the acquisition clocks of the computer vs. the Arduino. Better would be to measure your signal and generate your reference using one system, i.e. every time through the Arduino's outer loop, have it measure the voltage and also generate a reference level based on the internal clock, and transfer both to the computer.
    That said, unless you know the signal frequency very precisely a priori, the phase difference between a synthetic reference and a measured signal will inevitably drift with time, at a rate proportional to the difference between the nominal and actual frequencies of the sample signal. 

Maybe you are looking for