MATLAB Answers

# splitting real and imaginary part of a complex equation in order to generate two nonlinear equations to solve for two unknown real constants

36 ビュー (過去 30 日間)
Joey 2019 年 3 月 12 日
コメント済み: Torsten 2019 年 3 月 13 日
Hey Im having real struggle in solving a set of equation which in the beginning looked pretty straight forward, but as I am no Matlab-Hero yet I kinda saw no other way than to ask the community.. I probably miss something which could be pretty obvious and very wrong in my beliefs on how matlab eqations work:
The project is about measuring the reflection coefficient with an open ended coaxial probe and generate an approximation of the complex permittivity using the Debye model for permittity (eq.[2]) (work based on Radim Zajícek et al. 2010, https://www.radioeng.cz/fulltexts/2008/08_01_14_19.pdf).
First, the reflection coefficient S11 of a sample with known permittivity (distilled water) is measured over a range of frequency and the admittance of the setup is calculated (eq. [1]). Second step would be inserting the permittivity model in eq. [3] and equal it with the meassured admittance in order to get the constants G0 and C0. For this, it is crucial to split the real and imaginary part of the equation, so that we get two real nonlinear equations for two real unknowns and . Eventually, one should be able to measure S11 and compute complex permittivity in approximation by solving the unknown real and imaginary part of the complex permittivity (CAVE: 5th order equation in terms of (and the whole simplified math being within a certain range of error I am aware of that comodity).
[1]
[2]
[3]
i being the complex unit
w being angular frequency
water parameters at 30° C:
optical permittivity at high frequencies = 4.6
static permittivity at low frequencies = 78.3
electrical relaxation time of water = 8.07ps
where I am struggling is the splitting of the real and imaginary part of the eq. [3] and the solving. If I let Matlab compute it, there is always some nasty junk of complex i in the real part and vice versa.
Z0 = 50;
Y0 = 1/Z0;
e_inf = 4.6; % optical permittivity at high frequencies
e_s = 78.3; % static permittivity at low frequencies
tau = 8.07e-12; % electrical relaxation time of distilled water (T=30°C)
f = csvread('frequency.csv');
w = 2*pi*f;
syms G0 C0
assume(G0,'real');
assume(C0, 'real');
water_s11 = csvread('S11_data.csv'); % load attached csv-file
ec_water = e_inf + (e_s-e_inf)./(1+1i*w*tau);
Y_m = Y0.*((1-water_s11)./(1+water_s11)); %m for measured s for simulated
Y_s = G0.*ec_water.^(5/2)+1i.*w.*ec_water.*C0;
Y_sr = real(Y_s);
Y_si = imag(Y_s);
Y_mr = real(Y_m);
Y_mi = imag(Y_m);
G0 = solve(Y_mr(1) == Y_sr(1), G0); %this surely is wrong but i dont know how to solve it
C0 = solve(Y_mi(1) == Y_si(1), C0); %I compute here only for the first element cause otherwise it would take forever
So, if you'd compute this, you get emtpy 0-by-1 symbolics for G0 and C0; also there will be expressions like imag(C0) in the supposed real part of the Y_sr and Y mr..
update (12.03. 1600): if i now compute, the splitting still doesn't work but there are some values in G0/C0 but involving the other variable as well
my thinking was kinda: problem is, that with being a complex number and in the real part of the equation multiplied with G0, some complex i has to probably stick with it, unless it doesn't disapear on account of mathematical tricks physical coincidences (if there are such things?)
If anyone had some input I'd be very greatful - just a learning student :)
Thank you so much in advance,
Joey

サインインしてコメントする。

### 採用された回答

Torsten 2019 年 3 月 12 日

Z0 = 50;
Y0 = 1/Z0;
e_inf = 4.6; % optical permittivity at high frequencies
e_s = 78.3; % static permittivity at low frequencies
tau = 8.07e-12; % electrical relaxation time of distilled water (T=30°C)
f = csvread('frequency.csv'); % array of frequencies
w = 2*pi*f;
water_s11 = csvread('S11_data.csv');
ec_water = e_inf + (e_s-e_inf)./(1+1i*w*tau);
Re1 = real(ec_water.^(5/2));
Im1 = imag(ec_water.^(5/2));
Re2 = real(1i.*w.*ec_water);
Im2 = imag(1i.*w.*ec_water);
Rej = real(Y0.*((1-water_s11)./(1+water_s11)));
Imj = imag(Y0.*((1-water_s11)./(1+water_s11)));
n = numel(Rej);
A = zeros(2*n,2);
b = zeros(2*n,1);
A(1:n,1) = Re1;
A(1:n,2) = Re2;
b(1:n) = Rej;
A(n+1:2*n,1) = Im1;
A(n+1:2*n,2) = Im2;
b(n+1:2*n) = Imj;
sol = A\b;
G0 = sol(1)
C0 = sol(2)

#### 2 件のコメント

Joey 2019 年 3 月 13 日
Thank you, Torsten, for your reply and input.
Could you maybe explain some of your thoughts behind your calculations? it looks a bit odd to me is the mrdivide operator of much sense here? And why did you stack the values of real and imaginary nature in such a way that you did? Also, A and b do not share the same number of columns, so Matlab would not calculate that part of sol = A\b.
joey
Torsten 2019 年 3 月 13 日
You want to determine real-valued G0, C0 such that the 3200 equations
G0*real(ec_water.^(5/2)) + C0*real(1i.*w.*ec_water) = real(Y0.*((1-water_s11)./(1+water_s11)))
G0*imag(ec_water.^(5/2)) + C0*imag(1i.*w.*ec_water) = imag(Y0.*((1-water_s11)./(1+water_s11)))
are best-possible satisfied.
This is a linear fitting problem.
If you write the overdetermined system of linear equations from above as
A*[G0;C0] = b
you can get [G0;C0] via the backslash operator
[G0;C0] = A\b.
By the way: I modified the code that it runs now.

サインインしてコメントする。

R2018a

Translated by