Phase shift a signal data
hi all
i want to phase shift a signal of 90 degree. i am having the signal data as 1d array,using the data i want to shift the phase of the the signal .....any one....
Indrajit
| [email protected] | [email protected] .
Hi Indar,
You have several options--however the best is to devise a formula for the phase shift and then put this is the formula node in LabView to process the array data. Alternatively, you can use the Hilbert Transformation to apply a uniform phase shift to waveform data. Please refer to Echo Detector.vi or my simple example attached below.
Ipshita C.
National Instruments
Applications Engineer
Attachments:
Hilbertwitharray.vi 90 KB
Similar Messages
-
Hello,
I have two sinusoids which have a phase difference which varies slowly over time, the difference being indicative of position. To measure the phase difference, i have used a premade vi called "Graph and Calcuate Phase differece". I have also used an example online to somewhat sucessfully calculate the phase some of the time. The example would be the code that was posted in this thread.
http://forums.ni.com/ni/board/message?board.id=170&message.id=6956&query.id=101197
These examples work great with theoritcal signals, but there is a problem (see figure below) I am having in practice.. Since the phase shift can occur in the range [-360,+360], i believe the index of the peaks are getting lost, causing it to pick up the next peak in the sequence, thus, causing a phase shift (see figure below, plot of phase shift) to be measured. Another way of saying this is that after a small amount of phase shifting occurs, the lead peak begins to references the next peak in the comparison signal.
Im at loss on how to identify the peaks and track them so i can accurately measure phase shift. Any help is appreciated. Im sure this is soemthing that has been done before, esp since there is a vi just for measuring phase shift. I guess i just dont know the key words to find it...
Below is a screen shot showing the two signals. The bottom plot is showing there is a relative small shift in phase which periodically jumps.
many thanks
Jim from CT
Message Edited by JimmyinCT2 on 01-23-2008 07:17 PMdahhh, okay, i think i finally figured out what is going on here, and i think im just being somewhat dumb or maybe just assuming to much.
Looking at matts example helped a lot as i see why.
with one of the old VIs for measuring phase shift, we were getting a phase shift range of [-360, 360] or more. We were just assuming that was the range here with this new VI.
With the new dual channel measurement (or the example you posted), when phase is measured, there is an inflection point at some angle of phase difference.. The way your example works (and the express vi) is with an inflection at 180 degrees. So, lets imagine we have a measurement of phase shift that is 178 degrees, as this difference increases, the next is 179, and then 180.. Now as it continues to move, the next phase measurement will not bet 181 but instead -179. As the signal continues to move in the same direction, its then 178, 177, 176.. So there is an inflection point at 180 degrees with two sinusoids, in simple terms, its because the phase difference of one sinusoid to the other has shifted and is now being measured in reference to the next peak in the series.
Its troubling for measurements are if you turn on a machine that is measuring phase, and it happens to be right near -/+180, it can cross that boundary often, creating substantial noise. Also, that for certain types of peak detection, such as for motion, its desirable to have a larger range such as [-360,360] which should be theoretically possible (like the first vi we used) but i guess [-720, 720] could be done too assuming there is enough difference between the peaks. It would have been awesome to have a VI that measures peak movement outward to infinity. We were originally using a VI that calculated out these larger differences, think it was doing the calcs in frequency domain (imaginary nums) rather then cross correlation like the example.
I think for now, we are going to have to work inside the range [-180,180] and initialize our hardware to 0 phase so we dont start near the inflection point and see if that works.
Message Edited by jimmyinCT on 01-26-2008 07:54 PM -
Phase shift, frequency of 2 analog signals, Diadem 9.0 or 9.1
I have to acquire 2 signals: FORCE (N) and VELOCITY (m/s) for many frequencies parameter in Diadem 9.0 (5 to 150 Hz). This frequency parameter is a analog voltage output signal which is converted in frequency by a frequency vibrator instrument. The measured signals on the vibrator (force and velocity) are considered as SINE Functions. – 1) How do I measure the output frequency of the two signals and how can I save this data ? – 2) How can I estimate the phase shift between FORCE and VELOCITY ? – 3) How can I automate the estimation of the phase shift by the 145 measurement (150-5Hz) ? – 4) Is a continue measurement of Phase Shift depending on the frequency possible ? – Best Regards from Germany and from France.
Jean-Pierre, Junior Engineer GermanyHello KenT. I have test your DIAdem exemple. Your idea with a stop-time was not bad for measuring the phase shift beetween 2 generators by 1Hz. I have used this formula by many phase shift and it works. I had change the 2 generators frequency by 2Hz, and the formula works not anymore and that is normaly because of the reduce of the periode lenght (this problem have I show on Picture 3 of the PDF Data). On the picture 6 and 7 have I try to make another solution. My new solution works only for frequency from 1Hz to 5Hz. What about frequency like 150Hz ? I don't know if you have understood what I realy want to do, but if you have any idea to resolve my problems, please write to me. '[email protected]'
Jean-Pierre, Junior Engineer Germany
Attachments:
DIAdemTexte.pdf 435 KB -
Simulate Signal phase shifting loop
I am trying to use a loop to phase shift a simulated signal across 360 deg. My loop will change amplitude, frequency, offset, but it won't change the phase, does anyone know how I can do this? I have attached a code that shows the fundamental problem.
Solved!
Go to Solution.
Attachments:
SimSigPhaseShift.vi 34 KBWhen you wire a graph to it and set the graph to ignore timestamps, you see the phase shift. If you wire a chart to it, wire a true constant to the reset input of the simulate signal.
-
Phase shift a channel and display
Hi,
I am working on a project for which I need to display the I-Q constellation plot and normalize the data to fit it to a circle of unit radius.
I am able to do this but the problem is sometimes the signal in one of the channels is very weak and so the plot moves close to the axes(please find attached the file, this is the best position, if one channel has a weak signal, the point moves to one of the axes). When this happens, I want to add a phase shift to the signal (45 degrees and multiples of it) to bring to back to the best position. I was trying to use the Extract Tone vi to get the phase , add 45 degrees but how do I reconstruct the signal wit the new phase?
Can anyone please help me?
Thanks so much,
Sharmi
Solved!
Go to Solution.
Attachments:
11.png 68 KB
11.png 68 KBTo fit a circle, simply use "fitting on a sphere" with the Z values set to zero. No fancy math needed.
To create a unit circle, use complex math, (see image). Much simpler!
To rotate in the complex plane, multiply with a suiteable complex number. (See image).
XY graphs handle complex arrays directly, plotting IM vs RE. No need for clusters.
Attached is a quick draft. I only focused on the exact area of interest, leaving everything else as is. I did not check the rest of the code.
The control let's you shift the phase of the data from -pi to +pi.
LabVIEW Champion . Do more with less code and in less time .
Attachments:
IQPhaseShift.png 10 KB
RFSA Acquire Continuous IQ_MODCA.vi 77 KB -
Hi all,
I am continuously acquiring two sinusoidal signals from the analog inputs of a daq card and saving the samples of the two signals into two different float type arrays. Can anyone tell me that how to calculate the phase shift between these two signals and as well as the peak voltage of the two signals? Please expain me with the help of an example code.
ThanksHi AI S
I have gone through the example of phase diff e.g and i have written the following code but when i run it , it gives the max value of 1st sine wave (outarray1) nearly equal (i-e 7.7 volt ) but it should be 8 V pk.
But for the 2nd sinewave (outarray2) it gives the max value from 0 volt to 1.5 volt pk but it should give 1.5 Volt pk only and the phase difference is displayed as 0.000 , even there is no update in decimals in it.
One more thing to tell that 1 complete sine wave consists of 1024 samples , therefore in outarray1 and outarray2 , there are 8 cycles each. In one iteration of the loop outarray1 is filled and in other iteration outarray2 is filled , then i calculate the phase shift. Please tell me what i am doing wrong.
Here is my code
double outarray1[8192],outarray2[8192] ;
double *peakLoc, *peakAmp, *peakDeriv;
int count;
static double wave1maxval = 0.0;
static int wave1maxind = 0;
static double wave2maxval = 0.0;
static int wave2maxind = 0;
static double phasediff;
PeakDetector (outarray1,8192,0.0, 3, 0, 1, 1, &count, &peakLoc, &peakAmp, &peakDeriv);
if (count>0)
wave1maxind = peakLoc[0];
wave1maxval = peakAmp[0];
SetCtrlVal(panelHandle,PANEL_wave1maxind, wave1maxind);
SetCtrlVal(panelHandle,PANEL_wave1maxval, wave1maxval);
if (peakLoc)
FreeAnalysisMem (peakLoc);
if (peakAmp)
FreeAnalysisMem (peakAmp);
if (peakDeriv)
FreeAnalysisMem (peakDeriv);
PeakDetector ( outarray2,8192,0.0, 3, 0, 1, 1, &count, &peakLoc, &peakAmp, &peakDeriv);
if (count>0)
wave2maxind = peakLoc[0];
wave2maxval = peakAmp[0];
SetCtrlVal(panelHandle,PANEL_wave2maxind, wave2maxind);
SetCtrlVal(panelHandle,PANEL_wave2maxval, wave2maxval);
if (peakLoc)
FreeAnalysisMem (peakLoc);
if (peakAmp)
FreeAnalysisMem (peakAmp);
if (peakDeriv)
FreeAnalysisMem (peakDeriv);
phasediff = (8/8192) * (wave1maxind - wave2maxind) * 360;
phasediff = fmod (phasediff, 360);
SetCtrlVal(panelHandle,PANEL_Phase_Diff,phasediff); -
How can I create a phase shift that will cause cross-cancellation?
I recently recorded something using a USB audio input, and after it was done realized that a cellular device had interfered with the signal and I have a terrible hiss, some clicks, cell noise, etc. in the recording. Setting a noise print and running "Reduce Noise" did more to help this file than I ever would have thought possible (thank you Apple!!), but I think I might be able to do even better.
The left channel has the audio I need, plus all the noise. The right channel has ONLY THE NOISE! Can anyone think of a way that I can use this right channel to create a cross-cancellation of the noise in the left channel? Theoretically, this should create a perfect (or close enough to it for me) file, should it not?
The phase shifter doesn't seem to have what I would need to do this, but I'm sure some audio genius out there can think of a way I can either do this manually or with a filter or effect.
Thanks for any suggestions!Hi Glen,
IF you were to take two +identical signals+, sum them in equal amounts and flip the phase on one of them 180º to the other you will get +complete cancellation+.
According to the manual on page 221 the Process>Invert will do this.
Invert
+Choosing this command inverts the phase of each sample in the audio file or selection.+
+Each sample’s amplitude is unchanged, but the phase is inverted. In the waveform+
+display, the wave’s crests become troughs and vice versa.+
IF your R channel is the exact same noise as the noise in your L Channel then this technique could work for you.
You can test this out with any track -> put a copy of it on another track and Invert, they resulting playback will be total silence. -
How do I apply a uniform phase shift to a waveform?
In LabVIEW 6.0, I am attempting to apply a uniform phase shift to a non-periodic waveform but have run into a problem. Theoretically, if I take the Fourier transform of the signal, apply an offset to the phase and then take the inverse transform of that, the output of this process should be my original waveform with all of its frequency components delayed by the same number of radians (different amounts of time). However, I am not getting this result from LabVIEW. In the attached example code I generate a sine wave burst, take the FFT, convert from cartesian to polar, apply an offset to the phase, convert back to cartesian and take the inverse FFT. However, instead of getting a phase-shifted, same-amplitude versio
n of the input at the output, I get an amplitude shifted, same-phase signal. What am I doing wrong?
Attachments:
phase-shift.vi 51 KBThis only works (partially) if your array size is an integral power of 2 (e.g. 512, 1024, etc.), i.e. in cases where the fast fourier transform can be used.
You need to use the complex FFT (and the hilbert transform)
Please see my example posted HERE
LabVIEW Champion . Do more with less code and in less time . -
I am using LabView7.1 and am trying to understand how the FFT measures the phase difference between 2 analog input signals. The 2 signals have about the same amplitude and their phases will be about the same. I am getting a phase difference of exactly 0.000000 but there should still be a difference. Not sure how the FFT block compares the two signals. Do I need to specify which is the reference signal? If so, how do I go about doing that?
Thanks,
SparkEE
Attachments:
BTB Acceleromter.vi 378 KBI admit this is not 100% on mark but may give you some ideas. In this thread I suggested using a zero-phase shift filter. Ignore this post if it does not help.
Ben
Ben Rayner
I am currently active on.. MainStream Preppers
Rayner's Ridge is under construction -
Bonjour,
J'utilise une carte PCI6601 NI DAQ traditionnel avec LV6 et je génère 4 signaux à l'aide de "Multiple Counters with Phase Shifts.llb"fournit par NI. Cela marche très bien néanmoins je voudrais pouvoir rajouter le nombre d'impulsion. Ce nombre serait le même pour les 4 signaux.
Merci d'avanceMonsieur,
Dans cet exemple vous ne pouvez fixer le nombre d'impulsion puisque c'est une generation d'impulsion en continue. Vous devez donc modifier cet exemple afin que le compteur 0 ne genere pas en continue notamment en prenant comme exemple le VI finite pulse train qui utilise un compteur comme gating du compteur qui genere.
France.support -
Distance measurement using Ultrasonic sensors and phase shift method
Hi,
I've recently started a project where the idea is that we have an ultrasonic transmitter and a receiver. The transmitter will send out a signal at 40 kHz that will hit some object, most likely a book, and reflect that signal to the receiver. The received signal should have a phase difference from the outgoing signal. Now, when we vary the outgoing signal, the phase shift should also change. Likewise, if we vary the distance to the object, the number of wavelengths that can fit in between the object and the transducers should also change. We would multiply the incoming and outgoing signals and measure the beat signal, but I'm not sure how we would do this in labVIEW. We can calculate the distance to the object by figuring out what d(phase)/d(frequency) is. So far,when I am having problems with actually getting an incoming signal and figuring what that phase shift is. I'm not sure how I could use simulate signal to accuately and precisely send out a 40 kHz sine wave, and then vary that signal by steps of 1 Hz. I have also tried using a signal generator, and having once BNC cable go to the input of the transmitter and the other going to input of the DAQ. I have another BNC cable going from the output of the receiver to the input of the DAQ. I had multiple channels on my DAQ, and used split signals to see the transmitted and received signal. But this doesn't seem to be working. I also tried to add gain to the received signal, but when adding an Op-Amp LF356 to the receiver, the signal completely disappears. Attached are some of the VI's I have, but none of them seem to be working. Thanks in advance for any help.
Attachments:
Latest version of final.vi 64 KB
Draft for final project.vi 89 KBHave you done the basic physics and mathematics? For the speed of sound = 343 m/s and the frequency = 40 kHz the wavelength is 8.6 mm. At 40.001 kHz the wavelength is 214 nm shorter.
So, how do you propose to keep track of the number of wavelegnths if the target moves more than 8.6 mm?
To measure a phase shift you must have some kind of reference. Typically a fraction of the transmitted signal is used as a reference. Since you probably do not know how much phase shift occurs in the power amplifier driving the transmitter or between the electrical signal at the transducer and the acoustic signal in air, it is usually best to measure both, ideally with the same receiver and amplifiers.
The LF356 should be good for modest amounts of gain. The transducers can look like a capacitance to the circuits. Do you have a DC offset which is saturating the amplifier?
Lynn -
Determine phase shift ben input & output
hello guys,
I want to determine the phase shift between input and output signals. I want to measure the phase difference as lomg as I apply input. And save that to a file for reveiwing it later.Can anyone please help me with that. I am using Labview 7.1.
Thanks,
JinalHi Jinio,
Please take a look at the following KnowledgeBase article:
How Can I Determine Phase Mismatch Between Two Channels? -
Dear all,
i have create a simple model to find the phase shift of 2 waveform using the dual channel spectral measurment model. My waveforms for both signal r of transient type, ie their phase shift is different from each cycle and as such i not sure abt the phase shift result.
refer to attachment:my first graph is the signals of both waveform and the first cycle phase different is 11.28 degree and the second cycle onwards is 28.2 degree. the 2nd graphs shows the phase response of the both signal and the result is 24.2 degree.can some 1 pls advise me how those the dual channel spectral measruement model give the result of both waveform phase response as 24.2 degree.I am bluffed.
urgent request.
Cheers
Shawn
Attachments:
PHASESHIFT.JPG 539 KBI am assuming that negating the result is not going to give you the
right answer. Then, you can try the inverse Hilbert Transform.
Randall Pursley -
Phase shift between a pulse and sin wave
Hello,
I was wondering if there is any VI that I can use to get the phase shift between a pulse and a sin wave (they have same frequency).
The Ideal case is that the pulse should go to 1 when sin wave is positive and goes to 0 when the sin wave is negative. I want to set this test to measure the phase shift between pulse going to one and sin wave going positive.
We just bought labview full version with Signal processing package, and I was wondering if there is anything that would be useful for me.
Thanks in advance,
Baran.Hi Baran,
Try this on for size and see if it works for you.
Have a great day,
Chris V
Applications Engineer
National Instruments
Attachments:
Phase Difference.vi 22 KB -
Hi!
I have got a question relating the measurement of the phase-shift between an in- and outgoing voltage (both analog and the same frequency) of my DAQ-Device.
I can´t find a VI to detect or measure the phase-shift and I don´t know how to solve this problem. So somebody can help me? Somenone can tell me if there´s a VI in the /examples folder or can send me a self-made VI? Or someone just can tell me how to begin...???
Thanks!
[email protected]Mario,
This is a difficult thing to do accurately in software. Since the two signals may be different amplitudes, you need to measure the time difference between the zero crossings. Sample the two signals at a high rate using a simultaneous sample and hold A/D card, then measure (calculate) the time difference between each signal's zero reading (i.e. the zero crossing).
Hope this helps,
John
Maybe you are looking for
-
Weird problem trying to install XP using Boot Camp 3.0.1
Hi everyone, first post here. I have been trying to install XP in my Mac Pro using Boot Camp and a very strange thing happened. I created the partition allright, I inserted my Windows XP cd, hit install, the computer restarted and that´s when it froz
-
Please let me know the answer
-
Windows ISE 1.1.2
Hi, I am running cisco ISE 1.1.2 and the PC's are running windows 8. the option to deploy client provisioning for windows 8 does not seem to appear. Please suggest. do we need some patch to be able to do this ?
-
I am writing a program where i have to read in a graph object. I am not sure how to read in an object from a file though. I am trying to use an objectinputstream variable.readobject(). Is this right?
-
Help: SOAP Response Fault when big string is returned
Hello all, I'm quite newbie on Flex and SOAP, so sorry if I'm making an obvious question I have an application in Flex that consumes a webservice, and everything runs smoothly until I try to return a big string, which I find to be odd. In my tests