solve equation : Empty sym: 0-by-1

조회 수: 1 (최근 30일)
Salwa Ben Mbarek
Salwa Ben Mbarek 2021년 4월 15일
답변: Star Strider 2021년 4월 15일
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);

답변 (1개)

Star Strider
Star Strider 2021년 4월 15일
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.

카테고리

Help CenterFile Exchange에서 Formula Manipulation and Simplification에 대해 자세히 알아보기

태그

제품

Community Treasure Hunt

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

Start Hunting!

Translated by