# solve equation : Empty sym: 0-by-1

14 views (last 30 days)
Salwa Ben Mbarek on 15 Apr 2021 at 14:47
Answered: Star Strider on 15 Apr 2021 at 15:09
Hello,
I'm trying to solve a system (Im(A) = Im(B) , real (A) = real(B)) of two complex numbers with the variable "sigma" considered as the unknown.
The problem is that when I run the program, I found " Empty sym: 0-by-1" .
Coud you help me please ?
Thank you.
Here's the code:
freq = linspace(10*1e3, 31*1e6,100);
w = 2*pi.*freq; % angular frequency
p= 6.5 *1e-3;
d= 0.6*1e-3;
r = d/2;
mu0 = 4*pi*1e-7;
mur= 200;
sigw= 8.2183e+05;
Rw = (pi*sigw*(r^2))^(-1);
tau = mu0*mur*sigw*(r^2);
num = sqrt(1i.*w.*tau).*besseli(0, sqrt(1i.*w.*tau));
denum = 2.*besseli(1, sqrt(1i.*w.*tau));
Zw = Rw.*num./denum;
Ls = -((mu0*(p+d))/(2*pi)).*(log(1-exp(-(pi*d)./(d+p)))); %^(-1);
Zs = Zw*(d+p)+1i.*w.*Ls;
syms sigma
Zs2= (1+1j) .* ((w.*mur.*mu0) ./ (2.*sigma)).^(1/2);
A = real(Zs);
B= real(Zs2);
C= imag(Zs);
D= imag(Zs2);
Sreel= solve(A==B, sigma_Ss);
Simag= solve(C==D, sigma_Ss);

Star Strider on 15 Apr 2021 at 15:09
The Symbolic Math Toolbox may not be appropriate for this problem.
Try this:
freq = linspace(10*1e3, 31*1e6,100);
w = 2*pi.*freq; % angular frequency
p= 6.5 *1e-3;
d= 0.6*1e-3;
r = d/2;
mu0 = 4*pi*1e-7;
mur= 200;
sigw= 8.2183e+05;
Rw = (pi*sigw*(r^2))^(-1);
tau = mu0*mur*sigw*(r^2);
num = sqrt(1i.*w.*tau).*besseli(0, sqrt(1i.*w.*tau));
denum = 2.*besseli(1, sqrt(1i.*w.*tau));
Zw = Rw.*num./denum;
Ls = -((mu0*(p+d))/(2*pi)).*(log(1-exp(-(pi*d)./(d+p)))); %^(-1);
Zs = Zw*(d+p)+1i.*w.*Ls;
% syms sigma
for k = 1:numel(w)
Zs2 = @(sigma) (1+1j) .* ((w(k).*mur.*mu0) ./ (2.*sigma)).^(1/2) - Zs(k);
sigmav(k) = fsolve(Zs2, rand*1+1i);
end
figure
plot(w, real(sigmav))
hold on
plot(w, imag(sigmav))
hold off
grid
xlabel('\omega')
legend('\Re \sigma', '\Im \sigma', 'Location','best')
Experiment to get different results.