Advertisement
Guest User

Untitled

a guest
Apr 8th, 2020
282
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
MatLab 1.51 KB | None | 0 0
  1. clear;clc;close all;
  2. np = 129; %pulses
  3. mu = 4*pi*(10^(-7));
  4. eps = 8.854*(10^(-12));
  5. eta = 120*pi;
  6. acc = 99; %accuracy/number of frequency subdivisions, added acc's around
  7. %to just easily change one number
  8. length = .7; %antenna length
  9. h = length/2; %height
  10. lambda = linspace(length*pi/1,length*pi/3.5,acc); %LAMBDA DEPENDS ON L IN
  11. %THIS EXPRESSION, AND ITS THE INVERSE OF WHAT WE HAD BEFORE
  12. Y = zeros(acc,2);  
  13. for f = 1:acc
  14.     Y(f,1) = pi*length/lambda(f); %to get x-axis right, do this instead
  15.     r = 0.007022*lambda(f); %set value of changing radius
  16.     delta3 = 2*h/(np-1);
  17.     delta4 = 2*h/(2*(np-1));
  18.     k = (2*pi)/lambda(f);
  19.     Z = zeros(np,np);
  20.     Z(1,1) = 1;
  21.     Z(np,np) = 1;
  22.     pos2 = delta3;
  23.     for s = 2:(np-1)
  24.         poss = (s-1)*delta3;
  25.         Rr = sqrt(((pos2-poss)^2)+r^2);
  26.         term1 = (1j*eta/k)*(exp(-1j*k*Rr)/(4*pi*((Rr)^5)));
  27.         term2 = ((1+(1j*k*Rr))*((2*((Rr)^2))-(3*((r)^2))))+((k*r*Rr)^2);
  28.         Z(2,s) = term1*term2*delta3;
  29.     end
  30.     for p = 3:(np-1)
  31.         for g = 2:(np-1)
  32.             if(p >= g)
  33.                 Z(p,g) = Z(2,(p-g+2));
  34.             else
  35.                 Z(p,g) = Z(2,(g-p+2));
  36.             end
  37.         end
  38.     end
  39.     V = zeros(np,1);
  40.     V((np+1)/2) = 1;
  41.     I = (Z\V);%*10; %to use this, remove the ;% in between (Z\V) and *10
  42.     Y(f,2) = I((np+1)/2);
  43. end
  44. x = Y(:,1);
  45. y = Y(:,2);
  46. plot(x,real(y));
  47. hold on
  48. plot(x,imag(y));
  49. legend('Conductance','Susceptance');
  50. ylabel('G and B in mmhos'); %added labels
  51. xlabel('Beta*L/2'); %labels
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement