Documentation

This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

dsp.PhaseExtractor System object

Extract the unwrapped phase of a complex input

Description

The PhaseExtractor object extracts the unwrapped phase of a complex input.

To extract the unwrapped phase of a signal input:

  1. Define and set up your dsp.PhaseExtractor System object™. See Construction.

  2. Call step with your input signal to extract the signal phase according to the properties of this System object. The behavior of step is specific to each object in the toolbox.

Note

Starting in R2016b, instead of using the step method to perform the operation defined by the System object, you can call the object with arguments, as if it were a function. For example, y = step(obj,x) and y = obj(x) perform equivalent operations.

Construction

phase = dsp.PhaseExtractor returns a System object, phase, that extracts the unwrapped phase of an input signal.

phase = dsp.PhaseExtractor('PropertyName',PropertyValue,...) returns a System object, phase, with each specified property set to the specified value.

Properties

TreatFramesIndependently

Specify if you want to reset the unwrapped phase at the end of a frame.

If you set this property to:

  • true: The object treats each frame of data independently. It resets the initial cumulative unwrapped phase to zero each time a new input frame is received.

  • false: The object ignores boundaries between frames when returning the unwrapped phase.

The default value is false.

Methods

resetReset internal states of object
stepExtract phase of signal input
Common to All System Objects
clone

Create System object with same property values

getNumInputs

Expected number of inputs to a System object

getNumOutputs

Expected number of outputs of a System object

isLocked

Check locked states of a System object (logical)

release

Allow System object property value changes

Examples

expand all

Note: This example runs only in R2016b or later. If you are using an earlier release, replace each call to the function with the equivalent step syntax. For example, myObject(x) becomes step(myObject,x).

Create a dsp.SineWave System object™. Specify that the object generates an exponential output with a complex exponent.

sine = dsp.SineWave('Frequency',10,...
    'ComplexOutput',true,'SamplesPerFrame',128);

Create a dsp.PhaseExtractor System object™. Specify that the object ignores frame boundaries when returning the unwrapped phase.

phase = dsp.PhaseExtractor('TreatFramesIndependently',false);

Extract the unwrapped phase of a sine wave. Plot the phase versus time using a dsp.TimeScope System object™.

timeplot = dsp.TimeScope('PlotType','Line','SampleRate',1000,...
    'TimeSpan',1.5,'YLimits',[0 80],...
    'ShowGrid',true,...
    'YLabel','Unwrapped Phase (rad)');
for ii = 1:10
    sineOutput = sine();
    phaseOutput = phase(sineOutput);
    timeplot(phaseOutput)
end

Note: This example runs only in R2016b or later. If you are using an earlier release, replace each call to the function with the equivalent step syntax. For example, myObject(x) becomes step(myObject,x).

Create a dsp.TransferFunctionEstimator System object™.

tfe = dsp.TransferFunctionEstimator('FrequencyRange','centered');

Create a dsp.PhaseExtractor System object™. Specify that the object must treat each frame of data independently.

phase = dsp.PhaseExtractor('TreatFramesIndependently',true);

Create a dsp.IIRFilter System object™. Compute the transfer function of a third-order IIR filter. Use the butter function to generate coefficients for the filter.

[b,a] = butter(3,.3);
iir = dsp.IIRFilter('Numerator',b,'Denominator',a);

Extract the phase response of the transfer function. Plot using a dsp.ArrayPlot System object™.

sampleRate = 1e3;
phaseplot = dsp.ArrayPlot('PlotType','Line','XOffset',-sampleRate/2,...
    'YLimits',[-15 0],...
    'YLabel','Phase Response (rad)',...
    'XLabel','Frequency (Hz)',...
    'Title','System Phase response');
for ii = 1:100
    % Generate input
    input = 0.05*randn(1000,1);
    % Pass through IIR filter
    filterOutput = iir(input);
    % Estimate transfer function
    transferFunction = tfe(input,filterOutput);
    % Plot transfer function phase
    phaseOutput = phase(transferFunction);
    phaseplot(phaseOutput);
end

Algorithms

Consider an input frame of length N:

(x1x2xN)

The step method acts on this frame and produces this output:

(Φ1Φ2ΦN)

where:

Φi=Φi1+angle(xi1*xi)

Here, i runs from 1 to N. The angle function returns the phase angle in radians.

If the input signal consists of multiple frames:

  • If you set TreatFramesIndependently to true, the step method treats each frame independently. Therefore, in each frame, the step method calculates the phase using the preceding formula where:

    • Φ0 is 0.

    • x0 is 1.

  • If you set TreatFramesIndependently to false, the step method ignores boundaries between frames. Therefore, in each frame, the step method calculates the phase using the preceding formula where:

    • Φ0 is the last unwrapped phase from the previous frame.

    • x0 is the last sample from the previous frame.

Extended Capabilities

See Also

Blocks

Introduced in R2014b

Was this topic helpful?