atanh of negative complex numbers

7 次查看(过去 30 天)
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 个评论
Derek Neal
Derek Neal 2023-3-25
编辑:Torsten 2023-3-25
Many apologies. I removed the model comparison. It should run now. The imag gamma should follow the same pattern as the real plot. But it is wrapping. I'm trying to learn how to unwrap it.
%% 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(2,2,2)
semilogx(f,real(gamma))%,'LineWidth',2);
grid on
title('Propogation Constant')
ylabel('attenuation constant (neper/m)')
subplot(2,2,4)
semilogx(f,imag(gamma));
grid on
ylabel('phase constant (radians/m)')
Torsten
Torsten 2023-3-25
The imag gamma should follow the same pattern as the real plot. But it is wrapping.
So you think MATLAB's atanh is wrong ?

请先登录,再进行评论。

采纳的回答

David Goodmanson
David Goodmanson 2023-3-31
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.

更多回答(1 个)

Walter Roberson
Walter Roberson 2023-3-26
移动:Walter Roberson 2023-3-30
%% 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')
ans = 
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.

类别

Help CenterFile Exchange 中查找有关 Price Interest-Rate Instruments 的更多信息

标签

产品


版本

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by