0
\$\begingroup\$

This is my Task which should be done in MATLAB. I have the MATLAB codes but need some changes.

1) As written in the task the L and H should be greater than 20h and impedance should be 50 ohms. Please help to adjust these parameters so that after changing the L and H I still get 50 ohms.

2) In the codes, in the last, I am not able to understand the Tolerance testing Part.

Codes:

%Clearing variables in memory and Matlab command screen
close all;
clear all;
clc;

%Problem data
L = 10; 
H = 4.5;
h = 0.5;
w = 0.6;
epsilon_0 = 8.854*10^-12;
epsilon_r = 3.05*epsilon_0;

%Dimensions of the simulation grid in x (xdim) and y (ydim) directions
xdim=50;
ydim=50;
dx = L/xdim;
dy = H/ydim;
N_strip1x = floor((L-h)/2/dx); % number of node along x axis of the left strip
N_strip2x = floor(N_strip1x + h/dx); % number of node along x axis of the left strip
N_strip1y = floor((H-w)/2/dy);
N_strip2y = floor(N_strip1y + w/dy);
r = cos(pi/(xdim/L))+cos(pi/(H/ydim));
alpha = 1;
%Initializing initial Potential matrix & boundary conditions for V_init
V=zeros(xdim,ydim);
V(N_strip1x,N_strip1y:N_strip2y) = 1;
V(N_strip2x,N_strip1y:N_strip2y) = 1;

%Initializing maximum number of iterations
max_iterations = 500;
Z0 = zeros(1,max_iterations);
figure,
for i = 1:max_iterations
    clc
    display(['iteration n° ',num2str(i),'/',num2str(max_iterations)])
    V_old = V;
    for x = 2:xdim-1
        for y = 2:ydim-1
            % evaluate on the same line of the strips
             if x == N_strip1x && y > N_strip2y && y  N_strip2y && y  N_strip1x
                V(x,y)=epsilon_r*V_old(x,y)+alpha*(((epsilon_r*V_old(x-1,y)+epsilon_r*V_old(x+1,y)+epsilon_r*V_old(x,y-1)+epsilon_r*V_old(x,y+1))/4)-epsilon_r*V_old(x,y));
                V(x,y) = (1/epsilon_r) * V(x,y);             
            end
            %evaluate outside the strips
            if x > N_strip2x || x  N_strip2y && y  N_strip2y && y  N_strip1x
                    V(x,y)=epsilon_r*V_old(x,y)+omega(o)*(((epsilon_r*V_old(x-1,y)+epsilon_r*V_old(x+1,y)+epsilon_r*V_old(x,y-1)+epsilon_r*V_old(x,y+1))/4)-epsilon_r*V_old(x,y));
                    V(x,y) = (1/epsilon_r) * V(x,y);             
                end
                %evaluate outside the strips
                if x > N_strip2x || x  0
            break
        end
    end
    n_iterations(1,o) = i;
end
figure,
plot(omega,n_iterations);
xlim([0.9 1.02]);
xlabel('Omega')
ylabel('Number of iteration')
title('Plot of number of iteration versus omega')

This shows how different parameters were taken

Formula used for SOR method

\$\endgroup\$
1
  • \$\begingroup\$ Can you share the resource the question is borrowed from? \$\endgroup\$
    – McSuperbX1
    Commented Dec 9, 2023 at 10:52

1 Answer 1

2
\$\begingroup\$

As written in the task the L and H should be greater than 20h and impedance should be 50 ohms. Please help to adjust these parameters so that after changing the L and H I still get 50 ohms.

The point of this requirement is that if \$L\$ and \$H\$ are large compared to \$W\$ and \$h\$, then they will not affect the characteristic impedance much. Adjusting \$L\$ or \$H\$ should not change \$Z_0\$ noticeably.

In general, increasing \$W\$ should reduce \$Z_0\$ and increasing \$h\$ should increase \$Z_0\$. That should give you enough to nail down a combination of \$W\$ and \$h\$ that reaches \$Z_0=50\ \Omega \pm 5\ \Omega\$ within 3 or 4 tries.

In the codes, in the last, I am not able to understand the Tolerance testing Part.

I can't read your codes, but this likely means simulating small changes in \$W\$ and \$h\$ to see how big a change they cause in \$Z_0\$.

\$\endgroup\$
4
  • \$\begingroup\$ Thanks for the valuable suggestion. I have to change w, L and H but 'h' is fixed i.e. 0.5. L and H should be greater than 20h i.e. 10. \$\endgroup\$
    – user170106
    Commented Apr 27, 2019 at 21:28
  • 1
    \$\begingroup\$ Changing L and H should not (if you start with them big enough) affect \$Z_0\$. Just adjust W. \$\endgroup\$
    – The Photon
    Commented Apr 27, 2019 at 21:29
  • 1
    \$\begingroup\$ Hint: if you want to cheat, remember the method of images. Your scenario is like a microstrip considered with the ground plane removed according to the method of images. And there are lots of microstrip solvers out there that can give you W for a desired \$Z_0\$. At the very least this can give you a very close guess for a starting point for your optimization. \$\endgroup\$
    – The Photon
    Commented Apr 27, 2019 at 21:33
  • 1
    \$\begingroup\$ You could also speed up your simulator by considering the symmetry plane in this problem and replacing it with a ground plane, giving you half the volume to perform the FEM in. \$\endgroup\$
    – The Photon
    Commented Apr 27, 2019 at 21:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.