atanh of negative complex numbers
5 views (last 30 days)
Show older comments
Derek Neal
on 24 Mar 2023
Answered: David Goodmanson
on 31 Mar 2023
Given x is a 1x1000 vector of complex numbers with positive real parts and both positive and negative imaginary parts, the function y=atan(x), the real part of y is correct, whereas the imaginary part of y cycles from postive to negative when I expect it to climb ever more positive, following my model as in the figure below. I believe this is a wrapping issue. How does one keep y from wrapping?
5 Comments
Torsten
on 25 Mar 2023
The imag gamma should follow the same pattern as the real plot. But it is wrapping.
So you think MATLAB's atanh is wrong ?
Accepted Answer
David Goodmanson
on 31 Mar 2023
Hi Derek,
For the troublesome subplot, try
semilogx(f,unwrap(imag(2*x*gamma))/(2*x))
The idea is that the phase is proportional to x*gamma, and that is what has to be unwrapped. The factor of 2 has to do with getting unwrap into its comfort zone where the jumps are close to 2*pi.instead of pi.
0 Comments
More Answers (1)
Walter Roberson
on 26 Mar 2023
Moved: Walter Roberson
on 30 Mar 2023
%% Compares multicore cable model calculations to mixed mode open/short
% measurments. Based on IEEE paper: "S-Parameter Measurements Yielding
% the Characteristic Matrices of Multiconductor Transmission Lines"
%% Cable length
x=50;
%% Import open/short measurements
%disp('select the S11_OC file')
%[S11_OC_name,S11_OC_path]=uigetfile('*.csv');
%S11_OC_file=fullfile(S11_OC_path,S11_OC_name);
%S11_OC_raw=readmatrix(S11_OC_file,'Range','B4:C1003');
S11_OC_raw=readmatrix("S11OC.CSV",'Range','B4:C1003');
%disp('select the S11_SC file')
%[S11_SC_name,S11_SC_path]=uigetfile('*.csv');
%S11_SC_file=fullfile(S11_SC_path,S11_SC_name);
%S11_SC_raw=readmatrix(S11_SC_file,'Range','B4:C1003');
S11_SC_raw=readmatrix("S11SC.CSV",'Range','B4:C1003');
f=readmatrix("S11SC.CSV",'Range','A4:A1003');
w=2*pi*f;
S11_OC=S11_OC_raw(:,1)+1i*S11_OC_raw(:,2);
S11_SC=S11_SC_raw(:,1)+1i*S11_SC_raw(:,2);
Zoc=50*(1+S11_OC)./(1-S11_OC);
Zsc=50*(1+S11_SC)./(1-S11_SC);
Z0=sqrt(Zsc.*Zoc); % from IEEE S-Parameter Measurements Yielding the Characteristic Matrices of Multiconductor Transmission Lines
% confirmed https://www.antenna-theory.com/tutorial/txline/transmission6.php
y=sqrt(Zsc./Zoc);
%% QUESTION LINE
% gamma returns complex number. Real portion agrees with my expectation.
% Imaginary part oscillates around 0 starting at 700kHz, related to quarter
% wavelength resonance.
gamma=atanh(y)/x;
subplot(3,2,1)
semilogx(f,real(gamma))%,'LineWidth',2);
grid on
title('Propogation Constant')
ylabel('attenuation constant (neper/m)')
subplot(3,2,2)
semilogx(f,imag(gamma));
grid on
ylabel('phase constant (radians/m)')
subplot(3,2,3)
semilogx(f, real(y))
grid on
title('real before atanh')
subplot(3,2,4)
semilogx(f, imag(y))
grid on
title('imag before atanh')
subplot(3,2,5)
semilogx(f, movmean(real(y), 10))
That last plot shows a smoothed version of the real part of the y value, before the atanh. It shows that the real coordinate is oscillating around 1.
Now let us look at the formula for atanh:
syms z
rewrite(atanh(z), 'exp')
Notice the 1-z . With real components < 1, the 1-z would be positive, and log() of that part would be real-valued. But with real components > 1, the 1-z would be negative, and log() of that part would be complex-valued.
I am not taking into account the complex component here, but the above suggests to me that it is not unreasonable that the imaginary component of the atanh would be oscillating.
0 Comments
See Also
Categories
Find more on Price Interest-Rate Instruments in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!