Phase Shift: Difference between revisions

From GNU Radio
Jump to navigation Jump to search
(This adds an example flowgraph. This flowgraph creates a complex sinusoid, then allows the user to adjust the phase in real time to see how it affects a time domain display and constellation diagram.)
(Added link to GRC file for the shown flowgraph.)
 
(7 intermediate revisions by the same user not shown)
Line 19: Line 19:
[[File:PhaseShiftDemo.jpg|800px|Flowgraph demonstrating the Phase Shift block. This flowgraph will allow the user to change the phase of a complex sinusoid and see how that affects the time domain and constellation graphs.]]
[[File:PhaseShiftDemo.jpg|800px|Flowgraph demonstrating the Phase Shift block. This flowgraph will allow the user to change the phase of a complex sinusoid and see how that affects the time domain and constellation graphs.]]


This flowgraph demonstrates how the Phase Shift block will change the phase of a complex sinusoid. It also demonstrates how shifting the phase will change its appearance on a constellation diagram. It creates a complex sinusoid (the [[Signal Source]] block), runs the sinusoid through the '''Phase Shift''' block, then into a [[QT GUI Time Sink]] for display of the time domain of the signal. The phase within the '''Phase Shift''' block is controlled by a [[QT GUI Range]] block. The range block allows the phase to be adjustable between -360 to +360 degrees (-2*pi to +2*pi).  
This flowgraph demonstrates how the Phase Shift block will change the phase of a complex sinusoid. It also demonstrates how shifting the phase will change its appearance on a constellation diagram. It creates a complex sinusoid (the [[Signal Source]] block), runs the sinusoid through the '''Phase Shift''' block, then into a [[QT GUI Time Sink]] for display of the time domain of the signal. The phase within the '''Phase Shift''' block is controlled by a [[QT GUI Range]] block. The range block allows the phase to be adjustable between -360 to +360 degrees (-2 π to +2 π).  


Along with that is a [[Complex Conjugate]] block that is used to show the phase in the [[QT GUI Constellation Sink]]. (NOTE: If the signal going into the constellation or '''Argand''' diagram is not at 0 Hz, or centered around 0 Hz, it will spin. This makes it impossible to see the actual phase.) By multiplying the phase-shifted sinusoid with its non-phase-shifted complex conjugate, we can see the phase shift as the range value is adjusted. Two [[Vector Source]] blocks create a more-visible cross bar showing the real and imaginary axes.
Along with that is a [[Complex Conjugate]] block that is used to show the phase in the [[QT GUI Constellation Sink]]. (NOTE: If the signal going into the constellation or '''Argand''' diagram is not at 0 Hz, or centered around 0 Hz, it will spin. This makes it impossible to see the actual phase.) By multiplying the phase-shifted sinusoid with its non-phase-shifted complex conjugate, we can see the phase shift as the range value is adjusted. Two [[Vector Source]] blocks create a more-visible cross bar showing the real and imaginary axes.
[[File:Phase-shift-demo-display.png|center|thumb|800px|This is a display from the flowgraph above. This shows the time domain and constellation diagram of a 125 degree (3π/4 radians) phase shift.]]


Gnu Radio blocks used for this demonstration: [[Signal Source]], [[Complex Conjugate]], [[QT GUI Time Sink]], [[QT GUI Range]], [[Variable]], [[Vector Source]], [[Multiply]], [[QT GUI Constellation Sink]]
Gnu Radio blocks used for this demonstration: [[Signal Source]], [[Complex Conjugate]], [[QT GUI Time Sink]], [[QT GUI Range]], [[Variable]], [[Vector Source]], [[Multiply]], [[QT GUI Constellation Sink]]
== GRC File ==
[[File:PhaseShiftDemo.grc]]


== Source Files ==
== Source Files ==


; C++ files
; C++ files
: [https://github.com/gnuradio/gnuradio TODO]
: [https://github.com/gnuradio/gnuradio/blob/main/gr-blocks/lib/peak_detector_impl.cc peak_detector_impl.cc]


; Header files
; Header files
: [https://github.com/gnuradio/gnuradio TODO]
: [https://github.com/gnuradio/gnuradio/blob/main/gr-blocks/lib/phase_shift_impl.h phase_shift_impl.h]


; Public header files
; Public header files
: [https://github.com/gnuradio/gnuradio TODO]
: [https://github.com/gnuradio/gnuradio/blob/main/gr-blocks/include/gnuradio/blocks/phase_shift.h phase_shift.h]


; Block definition
; Block definition
: [https://github.com/gnuradio/gnuradio/blob/main/gr-blocks/grc/blocks_phase_shift.block.yml blocks_phase_shift.block.yml]
: [https://github.com/gnuradio/gnuradio/blob/main/gr-blocks/grc/blocks_phase_shift.block.yml blocks_phase_shift.block.yml]


[[Category:Stub Docs]]
[[Category:Block Docs]]
[[Category:Block Docs]]

Latest revision as of 01:50, 13 April 2024

This block will phase shift the input signal by the specified phase by multiplying the input times a shift value:

gr_complex(cos(d_shift_in_radians),sin(d_shift_in_radians))

Notes:
If degrees are provided, the block automatically handles the conversion.

This block functions like a Multiply Constant, but with the constant set to ej·shift, i.e. the corresponding value on the complex unit circle.

Parameters

(R): Run-time adjustable

Phase Shift
default: '0.0'
Units
options: ['Radians', 'Degrees']

Example Flowgraph

Flowgraph demonstrating the Phase Shift block. This flowgraph will allow the user to change the phase of a complex sinusoid and see how that affects the time domain and constellation graphs.

This flowgraph demonstrates how the Phase Shift block will change the phase of a complex sinusoid. It also demonstrates how shifting the phase will change its appearance on a constellation diagram. It creates a complex sinusoid (the Signal Source block), runs the sinusoid through the Phase Shift block, then into a QT GUI Time Sink for display of the time domain of the signal. The phase within the Phase Shift block is controlled by a QT GUI Range block. The range block allows the phase to be adjustable between -360 to +360 degrees (-2 π to +2 π).

Along with that is a Complex Conjugate block that is used to show the phase in the QT GUI Constellation Sink. (NOTE: If the signal going into the constellation or Argand diagram is not at 0 Hz, or centered around 0 Hz, it will spin. This makes it impossible to see the actual phase.) By multiplying the phase-shifted sinusoid with its non-phase-shifted complex conjugate, we can see the phase shift as the range value is adjusted. Two Vector Source blocks create a more-visible cross bar showing the real and imaginary axes.

This is a display from the flowgraph above. This shows the time domain and constellation diagram of a 125 degree (3π/4 radians) phase shift.

Gnu Radio blocks used for this demonstration: Signal Source, Complex Conjugate, QT GUI Time Sink, QT GUI Range, Variable, Vector Source, Multiply, QT GUI Constellation Sink

GRC File

File:PhaseShiftDemo.grc

Source Files

C++ files
peak_detector_impl.cc
Header files
phase_shift_impl.h
Public header files
phase_shift.h
Block definition
blocks_phase_shift.block.yml