How to unwrap the phase of a complex electrical impedance signal

41 views (last 30 days)
Hi everyone,
I have a problem with unwrapping a phase. The real and imaginary parts of the phase are named as 'real_part' and 'imaginary_part, respectively, and attached to this question. When I plot the phase using atan2 function, I see a big jump in phase data. I tried to unwrap it using Matlab's unwrap function but it also did not work. The results are as shown:
Here is the code that I used:
phase = atan2(imaginary_part, real_part) * 180/pi;
phase_unwrapped = unwrap(atan2(imaginary_part, real_part)) * 180/pi;
fig_Phase = figure('Visible', true, 'Units', 'inches', 'Position', [0 0 20 20]);
subplot(1,2,1);semilogx(Frequency,phase,'b','LineWidth',2, 'DisplayName', 'Wrapped Phase');hold on
axis square; legend();
xlabel('Frequency (Hz)');
ylabel('Phase (degree)');
set(gca,'fontsize',28);box on;
xticks([1e0 1e1 1e2 1e3 1e4 1e5 1e6]);
subplot(1,2,2);semilogx(Frequency,phase_unwrapped,'r','LineWidth',2, 'DisplayName', 'Unwrapped Phase');
axis square; legend();
xlabel('Frequency (Hz)');
ylabel('Phase (degree)');
set(gca,'fontsize',28);box on;
xticks([1e0 1e1 1e2 1e3 1e4 1e5 1e6]);
hold off;
Could anyone help me fix this problem? The phase cannot be less than -90 degrees since this is a measuremental data. The phase jump occurs due to some simple operations.
  5 Comments
Easa AliAbbasi
Easa AliAbbasi on 9 Oct 2023
Thank you for the response. This data is not a direct measurement. Three impedances are measured and after some mathematical operations, this impedance is calculated. All measurements are performed carefully and the measurement device was calibrated before every meaasurement. Moreover, the measurements are repeated 10 times and their mean values are used for the mathematical operations.
Mathieu NOE
Mathieu NOE on 10 Oct 2023
hello again
maybe the error is somewhere in the intermediate computations - have you somehow checked each individual measurement vs theory ?

Sign in to comment.

Answers (1)

Sayan
Sayan on 12 Dec 2023
Hi Easa AliAbbasi,
I understand from your issue that the "Phase" plot of your readings are not as expected.
I do not think there is any issue with the code.However,you mentioned in the comments that the "real_part" of the reading is of the resistance and the "imaginary_part" is of the capacitance reactance value, which implies that the "real_part" should always be positive and the "imaginary_part" should always be negative. I have these two observations about the data.
  • From the 29th row of "real_part.mat" the value becomes negetive, but the resistance value cannot be negetive.
  • From the 45th row of the "imaginary_part.mat" the value becomes positive, but the capacitive reactance value cannot be positive.
Those are the reasons that I think the issue is with the measured data. Whenever there is a change of sign in the data, the "atan2" and "unwrap" functions provide unexpected results.
You can find more information on "atan2" and "unwrap" in the following documentations.
Hope this helps in resolving the issue.

Products


Release

R2021b

Community Treasure Hunt

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

Start Hunting!