在Simulink的​【复数转幅值、相位】​模块里得到的相位超出​[-π,π]?How to get the phase angle more than π or less than -π in Simulink using Model 【Complex to Magnitude-Angle】?

4 visualizzazioni (ultimi 30 giorni)
我需要两个信号的相位差,所以要得到各自相位不能折叠进[-π,π]。想请问有什么办法?

Risposte (1)

Sandeep
Sandeep il 3 Nov 2023
Hi Rui shu,
It is my understanding that you need to calculate the phase difference of two signals in a Simulink model and want to avoid the phase values being folded into the range of [-π, π], you can use the 'atan2' function to achieive this.
The 'atan2' function calculates the four-quadrant inverse tangent, which returns the angle in the range of [-π, π]. This range ensures that the phase values are not folded and provide the correct phase difference between the signals. In order to use 'atan2' for your model, please follow the below steps,
  1. Add a "Trigonometric Function" block to your model.
  2. Connect the output of the "Complex to Real-Imag" block to the input of the "Trigonometric Function" block.
  3. Open the block parameters and select the 'atan2' function from the drop-down menu.
  4. Add a "Gain" block to your model.
  5. Connect the output of the "Trigonometric Function" block to the input of the "Gain" block.
  6. Set the gain value to adjust the scaling of the phase angle if necessary.
  7. Connect the output of the "Gain" block to the desired output or further processing blocks in your Simulink model.
For more insight on the usage of 'atan2', you can refer the below documentation,
Hope you find it helpful.

Categorie

Scopri di più su Model Verification in Help Center e File Exchange

Tag

Prodotti


Release

R2021b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!