I am not getting the exact reactance part value j1.8 (mentioned in BOOK) using my code , I am getting zero for my reactance part code, Can anybody help me out?

I am here mentioning my code , using this code my input imedance should be 233.9_j1.8 ohm, I am getting 234 ohm for the real part but my reactance part of the input impedance is zero. Here, i am attaching the equations which I am using in my code for imedance calculation and I am also providing the code output plot from the book here. I am mainly using equation 25 to get output. I need exactly that figure value in output plot. I am getting exactly same for the real part by my reactance part is showing 0 value.Kindly fix my code so that I can get exact value for the reactance part.
%Parameters TE10
c= 299792458;
m=1;
n=0;
h= 0.0795e-2;
dm=2;
dn=1;
eps0= 8.85418782e-12;
epsR= 2.32;
eps= eps0*epsR;
a= 10e-2;
b= 1.5e-2;
theta1 =2e-2/(a+h);
z_p =-1.5e-2;
phi_p =1e-2/(a+h);
w= 5e-3;
Qf= 112.4;
del_eff= 1/Qf;
fr=[2349:1:2549]*1e+6;
fmn=c/(2*sqrt(epsR))*sqrt((m/(2*(a+h)*theta1)^2)+(n/(2*b))^2);
%fmn= 2449e+6;
befn= sin(m*pi*w/(4*a*theta1))/(m*pi*w/(4*a*theta1));
%Z= ((h*dm*dn)/(8*pi*a*b*theta1))*((cos (n*pi*z_p)/(2*b))^2)*((cos(m*pi*phi_p)/(2*theta1))^2)*((bessel(j0,m*pi*w)/(4*a*theta1)).^2)* ((del_eff^3)-i(freq)(freq^2-fmn^2))/(del_eff^4+)
Zin= h*dm*dn/(8*pi*eps*a*b*theta1)*cos(n*pi*z_p/(2*b))^2*cos(m*pi*phi_p/(2*theta1))^2*befn^2.*(del_eff*fr.^3-1i*fr.*(fr.^2-fmn^2))./(del_eff^2*fr.^4+(fr.^2-fmn^2).^2)
figure(1)
plot(fr*1e-6,real(Zin),'b','LineWidth',3);
hold on
plot(fr*1e-6,imag(Zin),'r','LineWidth',3);
set(gcf,'color',[1 1 1]);
set(gca,'fontsize',18);
xlabel('freq [MHz]')
ylabel('R and X [ohm]');
xlim([2349 2549]);
%ylim([1480 1560]);
legend('R','X');
for k=1:length(fr)
if(fr(k)==fmn) % replace fmn with any desired frequency to get the imput impedance at this freq.
Zin_res=complex(real(Zin(k))+imag(Zin(k)));
end
end
k
Zin_res

 Accepted Answer

Hi,
The 'Zin_res' is not calculated properly as the validation "if(fr(k)==fmn);" fails due to the mismatch in exact values. To get the input impedance at the resonant frequency find the index at which the difference between the current and the resonant frequency is minimum. Then index into the array.
Modified code:
%Parameters TE10
c= 299792458;
m=1;
n=0;
h= 0.0795e-2;
dm=2;
dn=1;
eps0= 8.85418782e-12;
epsR= 2.32;
eps= eps0*epsR;
a= 10e-2;
b= 1.5e-2;
theta1 =2e-2/(a+h);
z_p =-1.5e-2;
phi_p =1e-2/(a+h);
w= 5e-3;
Qf= 112.4;
del_eff= 1/Qf;
fr=[2349:1:2549]*1e+6;
fmn=c/(2*sqrt(epsR))*sqrt((m/(2*(a+h)*theta1)^2)+(n/(2*b))^2);
%fmn= 2449e+6;
befn= sin(m*pi*w/(4*a*theta1))/(m*pi*w/(4*a*theta1));
%Z= ((h*dm*dn)/(8*pi*a*b*theta1))*((cos (n*pi*z_p)/(2*b))^2)*((cos(m*pi*phi_p)/(2*theta1))^2)*((bessel(j0,m*pi*w)/(4*a*theta1)).^2)* ((del_eff^3)-i(freq)(freq^2-fmn^2))/(del_eff^4+)
Zin= h*dm*dn/(8*pi*eps*a*b*theta1)*cos(n*pi*z_p/(2*b))^2*cos(m*pi*phi_p/(2*theta1))^2*befn^2.*(del_eff*fr.^3-1i*fr.*(fr.^2-fmn^2))./(del_eff^2*fr.^4+(fr.^2-fmn^2).^2);
figure(1)
plot(fr*1e-6,real(Zin),'b','LineWidth',3);
hold on
plot(fr*1e-6,imag(Zin),'r','LineWidth',3);
set(gcf,'color',[1 1 1]);
set(gca,'fontsize',18);
xlabel('freq [MHz]')
ylabel('R and X [ohm]');
xlim([2349 2549]);
%ylim([1480 1560]);
legend('R','X');
% Find the index of the frequency closest to the resonant frequency fmn
[~, resonant_index] = min(abs(fr - fmn));
% Get the input impedance at the resonant frequency
Zin_res = Zin(resonant_index);
% Display the resonant frequency and the corresponding impedance
disp(['Resonant frequency index: ', num2str(resonant_index)]);
Resonant frequency index: 112
disp(['Resonant frequency (Hz): ', num2str(fr(resonant_index))]);
Resonant frequency (Hz): 2460000000
disp(['Zin at resonant frequency: ', num2str(Zin_res)]);
Zin at resonant frequency: 233.1588+6.230216i
Glad to help!

10 Comments

@Epsilon sir, its not giving me exact output , the output figure plot in the screenshot already mentioned in the book that my F10 is basically f mn = 2449MHz and at this resonant frequency for TM10 mode result is 233.9+j1.8, with my code I got 234 real part but still no reactance value, I run your given code it doesnot showing real part or imaginary part at the resonant frequency fmn=2449MHz, please correct this.
@Epsilon sir I am again highlighting output plot, the values are mentioned in the book 233.9+j1.8 ohm, kindly hlelp me to get the reactive part exact value. Thanks in advance!
As per the parameters and the Impedance formula mentioned in the original code, the resonant frequency appears to be approximately 2460MHz. The Impedance calculated at 2460MHz has 233.15 as the resistive component and 6.23 as the reactive component.
%%Input Impedence equation
%Parameters TE10
c= 299792458;
m=1;
n=0;
h= 0.0795e-2;
dm=2;
dn=1;
eps0= 8.85418782e-12;
epsR= 2.32;
eps= eps0*epsR;
a= 10e-2;
b= 1.5e-2;
theta1 =2e-2/(a+h);
z_p =-1.5e-2;
phi_p =1e-2/(a+h);
w= 5e-3;
Qf= 112.4;
del_eff= 1/Qf;
fr=[2349:1:2549]*1e+6;
%fmn=c/(2*sqrt(epsR))*sqrt((m/(2*(a+h)*theta1)^2)+(n/(2*b))^2);
fmn= 2449e+6;
befn= sin(m*pi*w/(4*a*theta1))/(m*pi*w/(4*a*theta1));
%Z= ((h*dm*dn)/(8*pi*a*b*theta1))*((cos (n*pi*z_p)/(2*b))^2)*((cos(m*pi*phi_p)/(2*theta1))^2)*((bessel(j0,m*pi*w)/(4*a*theta1)).^2)* ((del_eff^3)-i(freq)(freq^2-fmn^2))/(del_eff^4+)
Zin= h*dm*dn/(8*pi*eps*a*b*theta1)*cos(n*pi*z_p/(2*b))^2*cos(m*pi*phi_p/(2*theta1))^2*befn^2.*(del_eff*fr.^3-1i*fr.*(fr.^2-fmn^2))./(del_eff^2*fr.^4+(fr.^2-fmn^2).^2);
figure(1)
plot(fr*1e-6,real(Zin),'b','LineWidth',3);
hold on
plot(fr*1e-6,imag(Zin),'r','LineWidth',3);
set(gcf,'color',[1 1 1]);
set(gca,'fontsize',18);
xlabel('freq [MHz]')
ylabel('R and X [ohm]');
xlim([2349 2549]);
%ylim([1480 1560]);
legend('R','X');
for k=1:length(fr)
if(fr(k)==fmn) % replace fmn with any desired frequency to get the imput impedance at this freq.
Zin_res=complex(real(Zin(k))+imag(Zin(k)));
end
end
k
Zin_res
% for i=0:m
% for j=0:n
% end
% end
@Epsilon sir see the new code , in previous code mistakenly fmn was in comment, using this code i am getting exact value for the real part but reactance part X I am getting 0. kindly fix the last code I attached .Thanks!
The reactance should be zero at the resonating frequency as it changes sign there. That is why the complex part is 0.
yes, but according to the equation I attached from the book, the result is 1.8j but I am not getting this value for the imaginary part that's why I am posting my code here. Imaginary part can't be zero, can you kindly check my equation writing style is correct or not frpm my screenshot?@Epsilon sir
Hi, the flag is used to mark an incorrect or irrelevant response and not to mark the correct response. Please remove the flag from the comment.
@Epsilon sir, mistakenly it was done ! as I am new here did not know the fact. Sorry I removed the flag.

Sign in to comment.

More Answers (0)

Categories

Find more on MATLAB in Help Center and File Exchange

Products

Release

R2023a

Asked:

on 13 Nov 2024

Commented:

on 18 Nov 2024

Community Treasure Hunt

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

Start Hunting!