⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 sonnet_boxes_patch.m

📁 patchantenna matlab code
💻 M
字号:
function sonnet_boxes_patch(Er, length, width, width_res, h, Ro, sonnet_file, Leff) 

% This function was created by Gazi K ASadullah
% This function creates the geometry file  for Sonnet using the all the input parameters.
% width = width of microstrip Antenna
% Leff = Effective length of Microstrip Antenna
% h = Thickness of Microstrip Antenna
% length= length of Microstrip Antenna
% width_res = width of the feedline of microstrip Antenna
% Er= Dielectric constant
% Ro= Impedance of feedline
% Sonnet_file= Name of the file where the geometry will be created. 
% yo= Point of inset feed.


cell=0.1;


% Setting up the Cell size
if (width_res >= 0.2)
     cell=0.1;
 end
 
 if (width_res < 0.2)
     cell=0.05;
 end

% Calculating lamda
lamda=2*Leff;
dim4=lamda/cell;
dim4=round(dim4);
lamda=dim4*cell
  if (lamda <= 0.9)
     cell=cell/2;
 end
 
lamda=2*Leff;
dim4=lamda/cell;
dim4=round(dim4);
lamda=dim4*cell
% Rounding up the width of feedline based on cell size.
dim_3=(width_res/cell);
dim_3=round(dim_3);
width_res=(cell*dim_3);



% Rounding up the width of length of microstrip based on cell size.
dim1=length/cell;
dim1=round(dim1);
length=(cell*dim1);


% Rounding up the width of WIdth of microstrip based on cell size.
dim_2=width/cell;
dim_2=round(dim_2);
width=(cell*dim_2);


% [sonnet_file,sonnet_path] = uiputfile('antenna.geo','Save geometry file name');
% sonnet_file=strcat(sonnet_path, sonnet_file);
A=fopen(sonnet_file,'w');
n=2; %number of boxes
total_len=0;

%calculating to total length (outside box length) for Sonnet
total_len2=(lamda*6);

dimension = ((total_len2/cell))*2
dimension = num2str(dimension);

fprintf (A, '%s\n', 'LEN IN 0.0254');
fprintf(A, '%s\n' , 'REF 0 0 0 0 0 0 0 0');
fprintf(A, '%s\n' , 'TOP 376.7303136 0 0 0');
fprintf(A, '%s\n' , 'TON 0 Free Space');
fprintf(A, '%s\n' , 'BOT 0 0 0 0');
fprintf(A, '%s\n' , 'BON 0 Lossless');
fprintf (A, 'box 1 %d %d %s %s 20 0\n', total_len2, total_len2, dimension, dimension);
%fprintf (A, 'box 1 %.3f %.3f 1400 1200 20 0\n', total_len, total_width);
fprintf (A, '      %d 1 1 0 0 0 2 "Air"\n', total_len2);
fprintf (A, '      %d %f 1 0.0013 0 0 2', h, Er);
fprintf (A, '\n%s', 'POR 0 3 0 1 ');
fprintf (A, '%d 0 0 0 0 0 \n', Ro);
fprintf (A, '%s %d\n', 'NUM', n);
p=9;
fprintf (A, '0 5 -1 N %d 1 1 100 100 0 0 0\n', p);
%width_res=round_up(width_res);
%width=round_up(width);
%calculating the first box:
a=0;

b=0+((total_len2/2)-(width_res));
dim6=b/cell;
dim6=round(dim6);
b=dim6*cell;

c= b+width_res;

d=((total_len2/2)-(length/2));
dim5=d/cell;
dim5=round(dim5);
d=dim5*cell;

%converting to mm
box=[d c;d b;a b; a c];
fprintf (A, '%.3f %.3f\n', a, c);
fprintf (A, '%.3f %.3f\n%.3f %.3f\n%.3f %.3f\n%.3f %.3f\n ', d, c, d, b, a, b, a, c);
fprintf (A, '%s\n', 'END');
p=p+1;



%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Calculation for the first box (feedline for the patch antenna)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

  a=d;

  b=((total_len2/2)-(width/2));
  dim7=b/cell;
  dim7=round(dim7);
  b=dim7*cell;
  
  c=b+width;
  
  d=a+length;
  
  box=[d c;d b;a b; a c];
  fprintf (A, '0 5 -1 N %d 1 1 100 100 0 0 0\n', p);
  fprintf (A, '%.3f %.3f\n', a, c);
  fprintf (A, '%.3f %.3f\n%.3f %.3f\n%.3f %.3f\n%.3f %.3f\n ', d, c, d, b, a, b, a, c);
  fprintf (A, '%s\n', 'END');
  p=p+1;

fclose(A);

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -