How to unwrap the phase of a complex electrical impedance signal
조회 수: 49 (최근 30일)
이전 댓글 표시
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
Mathieu NOE
2023년 10월 10일
hello again
maybe the error is somewhere in the intermediate computations - have you somehow checked each individual measurement vs theory ?
답변 (1개)
Sayan
2023년 12월 12일
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.
- "atan2" : https://www.mathworks.com/help/releases/R2021b/matlab/ref/atan2.html#buct8h0-4
- "unwrap" : https://www.mathworks.com/help/releases/R2021b/matlab/ref/unwrap.html#mw_1884ee59-182e-4ef6-a323-ee5a45b76693
Hope this helps in resolving the issue.
댓글 수: 0
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!