% An investigation of the Zo of a microstrip line, parameterized for w/h % and e_r % % Hammersted and Jensen, published in Gardiol, 1994. % % Modernised away from gset etc..... % % AlanRobertClark@gmail.com 20250823 % 1; % Not a function file :-) % fsolve only has one var it can pass :-) global Er; global ZoVal=150; function retval = Zo (WoverH, Er) if (nargin != 2) usage ("Zo needs 2 args: w/h (vector) and Er (float)") endif a = 1 + 1./49.*log((WoverH.^4 + (WoverH/52).^2) / (WoverH.^4+0.432)) +... 1./18.7.*log(1+(1./18.1.*WoverH).^3); b = 0.564.*((Er-0.9)./(Er+3)).^0.053; EeffGardiol1994 = 0.5.*(Er+1) + 0.5.*(Er-1)./(1+10./WoverH).^(a.*b); F1 = 6 + (2.*pi-6).*exp(-(30.666./WoverH).^0.7528); ZoGardiol1994 = 60./sqrt(EeffGardiol1994).*log(F1./WoverH + ... sqrt(1+(2./WoverH).^2)); retval = ZoGardiol1994; endfunction; function y = f (x) global Er; global ZoVal; y = Zo (x, Er) - ZoVal; endfunction ErVector = logspace (0,1.3,100); ZoValVector = [200,175,150,120,100,75,60,50,35,20,10]; % Preallocate sizes :-) Storage = zeros(length(ErVector), length(ZoValVector)); i=0; j=0; for ZoVal = ZoValVector i++; j=0; for Er = ErVector j++; x = fsolve("f", 1); if x < 0 x = NaN; endif if x > 20 x = NaN; endif Storage(j,i)=x; endfor endfor loglog(Storage(:,1),ErVector',... Storage(:,2),ErVector',... Storage(:,3),ErVector',... Storage(:,4),ErVector',... Storage(:,5),ErVector',... Storage(:,6),ErVector',... Storage(:,7),ErVector',... Storage(:,8),ErVector',... Storage(:,9),ErVector',... Storage(:,10),ErVector',... Storage(:,11),ErVector'); title 'w/h as a function of $\epsilon_r$, parameterised by $Z_0$'; axis([0.1 20 1 5]); % There is a tension between having minor ticks, and being able to label % them. If we have minor on, grid looks fine, but only three labels (0.1, % 1, 10), if off, then I can manually add the rest, but then thousands of % minor lines. So kill minor, but then Must kill the minor bloody ticks % too. Previous syntax was infinitely better. grid on; grid minor off; ax=gca(); set(ax, "xtick", [0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9,... 1,2,3,4,5,6,7,8,9,10,20]); set(ax, "xticklabel", {"0.1","0.2","","","0.5","","","","",... "1","2","","","5","","","","","10","20"}); set(ax, "xminortick", "off"); % Sheesh..... set(ax, "ytick", [1,2,2.18,3,4,4.4,5]); set(ax, "yticklabel", {"1","2","PP","3","4","FR4","5"}); set(ax, "yminortick", "off"); xlabel "w/h"; % Note single quotes for LaTeX: ylabel '$\epsilon_r$'; %gset label "200" at 0.17,1.5 right; text(0.17,1.5,"200", "horizontalalignment", "right"); text(0.22,1.75,"175", "horizontalalignment", "right"); text(0.31,2,"150", "horizontalalignment", "right"); text(0.55,2.19,"120", "horizontalalignment", "right"); text(0.8,2.33,"100", "horizontalalignment", "right"); text(1.3,2.5,"75", "horizontalalignment", "right"); text(1.85,2.6,"60", "horizontalalignment", "right"); text(2.5,2.7,"50", "horizontalalignment", "right"); text(4.1,2.8,"35", "horizontalalignment", "right"); text(8.2,2.9,"20", "horizontalalignment", "right"); text(18,3,"10", "horizontalalignment", "right"); printFig("MicroZoParmsZoom");