atanh of negative complex numbers

4 ビュー (過去 30 日間)
Derek Neal
Derek Neal 2023 年 3 月 24 日
回答済み: David Goodmanson 2023 年 3 月 31 日
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 Center および File ExchangeData Import and Network Parameters についてさらに検索

タグ

製品


リリース

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by