diff --git a/5_Simulations/Matlab/16_8.m b/5_Simulations/Matlab/16_8.m new file mode 100644 index 0000000..60fa681 --- /dev/null +++ b/5_Simulations/Matlab/16_8.m @@ -0,0 +1,52 @@ +%Size of PCB +pcbThickness = 0.578e-3; +pcbLength = 200e-3; +pcbWidth = 200e-3; + +f = 10.5e+9; +c = 3e+8; +lambda = c/f; + +Length_patch = 8.76e-3; +Width_patch = 9.545e-3; +dist_patch = lambda/2; +feeder_width = 0.94e-3; + +%Specifying Material of PCB +pcbEpsilonR = 3.48; +%Creating dielectic Material +d = dielectric(Name="RO4350B",EpsilonR=pcbEpsilonR,LossTangent=0.003,Thickness=pcbThickness); +GndPlane = antenna.Rectangle('Length',pcbLength,'Width',pcbWidth); %Creating Ground Plane of Antenna +%Creating Different Shapes of antenna +Rec1 = antenna.Rectangle('Length',dist_patch-Length_patch,'Width',feeder_width,'Center',[0,(dist_patch-Length_patch)/2]); %feeder +Rec2 = antenna.Rectangle('Length',Length_patch,'Width',Width_patch,'Center',[0,(dist_patch-Length_patch)+(Length_patch)/2]); %patch + +for i=1:1:16 + for j=1:1:8 + Rec1 = Rec1 + antenna.Rectangle('Length',dist_patch-Length_patch,'Width',feeder_width,'Center',[i-1,j*(dist_patch)+(dist_patch-Length_patch)/2]); + Rec2 = Rec2 + antenna.Rectangle('Length',Length_patch,'Width',Width_patch,'Center',[i-1,j*(dist_patch)+(dist_patch-Length_patch)+(Length_patch)/2]); + end +end + +%Adding all different shapes of antenna +AntennaPlane = Rec1 + Rec2; + +%%Creating PCB Stack +p = pcbStack; +p.Name = 'Strip-fed slot'; +p.BoardShape = GndPlane; +p.BoardThickness = pcbThickness; +p.Layers = {AntennaPlane,d,GndPlane}; %[x Cordinate,y Cordinate,startLayer stopLayer] +p.FeedLocations = [0,0,1,3;0,dist_patch,1,3;0,dist_patch*2,1,3;0,dist_patch*3,1,3;0,dist_patch*4,1,3;0,dist_patch*5,1,3;0,dist_patch*6,1,3;0,dist_patch*7,1,3;0,dist_patch*8,1,3;0,dist_patch*9,1,3;0,dist_patch*10,1,3;0,dist_patch*11,1,3;0,dist_patch*12,1,3;0,dist_patch*13,1,3;0,dist_patch*14,1,3;0,dist_patch*15,1,3]; + +%Plotting Different patterns and graphs +figure(1); +show(p); %Display Antenna +% figure(2); +% pattern(p,1.943e9); %Display Radiation Pattern at 1.943GHZ +% figure(3); +% impedance(p,1.6e9:2e7:2.2e9); %Display Impedance Graph from 1.6GHz to 2.2GHz +% freq = linspace(1.6e9, 2.2e9, 50); % Creating Frequency Vector +% s = sparameters(p,freq,50); % Calalculate S11 for all frequencys +% figure(4); +% rfplot(s);%Diplay S11 Plot \ No newline at end of file diff --git a/5_Simulations/Matlab/Antenna16_8.m b/5_Simulations/Matlab/Antenna16_8.m new file mode 100644 index 0000000..fa0c13e --- /dev/null +++ b/5_Simulations/Matlab/Antenna16_8.m @@ -0,0 +1,108 @@ +n_array = 1; +m_array = 2; + +delta_phy = 15; %phase difference between adjacent patches (in degrees) + +f = 10.5e+9; +c = 3e+8; +lambda = c/f; + +Width_patch = 8.76e-3; +Length_patch = 9.545e-3; +dist_patch = lambda/2; +feeder_width = dist_patch - Width_patch; +feeder_length = 0.94e-3; + +% Define angles (break into smaller chunks) +theta = -90:1:90; +phi = -180:1:180; +chunk_size = 30; + + +% Define file name for saving +matFileName = 'pattern_data.mat'; + +% Create a MAT file object for incremental writing +mf = matfile(matFileName, 'Writable', true); + + + +%Size of PCB +pcbThickness = 0.508e-3; +pcbWidth = 0.5*feeder_width + (feeder_width +Width_patch)*(m_array); +pcbLength =dist_patch*n_array; + +%Specifying Material of PCB +% pcbMaterial = 'RO4350B'; +% pcbEpsilonR = 3.48; +pcbMaterial = 'RO4350B'; +pcbEpsilonR = 3.48; +d = dielectric(pcbMaterial); +d.EpsilonR = pcbEpsilonR; +d.Thickness = pcbThickness; +%Creating dielectic Material + +GndPlane = antenna.Rectangle('Length',pcbLength,'Width',pcbWidth,'Center',[0,0]); %Creating Ground Plane of Antenna +%Creating Different Shapes of antenna + Rec1 = antenna.Rectangle('Length',feeder_length,'Width',feeder_width,'Center',[-(pcbLength/2)+0.5*dist_patch,-pcbWidth/2+feeder_width/2]); + Rec2 = antenna.Rectangle('Length',Length_patch,'Width',Width_patch,'Center',[-(pcbLength/2)+0.5*dist_patch,-pcbWidth/2 + feeder_width+Width_patch/2]); + +for j=1:1:n_array + for i=1:1:m_array + if((i~=1) || (j~=1)) + Rec1 = Rec1 + antenna.Rectangle('Length',feeder_length,'Width',feeder_width,'Center',[(j-1)*dist_patch-(pcbLength/2)+0.5*dist_patch,-pcbWidth/2+feeder_width/2+(i-1)*dist_patch]); + Rec2 = Rec2 + antenna.Rectangle('Length',Length_patch,'Width',Width_patch,'Center',[(j-1)*dist_patch-(pcbLength/2)+0.5*dist_patch,-pcbWidth/2+feeder_width+Width_patch/2+ (i-1)*dist_patch]); + end + end +end + +AntennaPlane = Rec1 + Rec2; + + +%%Creating PCB Stack +p = pcbStack; +p.Name = 'Strip-fed slot'; +p.BoardShape = GndPlane; +p.BoardThickness = pcbThickness; +p.Layers = {AntennaPlane,d,GndPlane}; + +%[x Cordinate,y Cordinate,startLayer stopLayer] +p.FeedDiameter = feeder_length/4; + +p.FeedLocations = [-(pcbLength/2)+0.5*dist_patch,-pcbWidth/2+feeder_length/1.4,1,3]; + +%p.FeedLocations = [-(pcbLength/2)+0.5*dist_patch,-pcbWidth/2+feeder_length/1.4,1,3;dist_patch-(pcbLength/2)+0.5*dist_patch,-pcbWidth/2+feeder_length/1.4,1,3;dist_patch*2-(pcbLength/2)+0.5*dist_patch,-pcbWidth/2+feeder_length/1.4,1,3]; +%p.FeedLocations = [0,feeder_length/1.4,1,3;dist_patch,feeder_length/1.4,1,3;dist_patch*2,feeder_length/1.4,1,3;dist_patch*3,feeder_length/1.4,1,3;dist_patch*4,feeder_length/1.4,1,3;dist_patch*5,feeder_length/1.4,1,3;dist_patch*6,feeder_length/1.4,1,3;dist_patch*7,feeder_length/1.4,1,3;dist_patch*8,feeder_length/1.4,1,3;dist_patch*9,feeder_length/1.4,1,3;dist_patch*10,feeder_length/1.4,1,3;dist_patch*11,feeder_length/1.4,1,3;dist_patch*12,feeder_length/1.4,1,3;dist_patch*13,feeder_length/1.4,1,3;dist_patch*14,feeder_length/1.4,1,3;dist_patch*15,feeder_length/1.4,1,3]; +%p.p.FeedPhase = [0 delta_phy delta_phy*2 delta_phy*3 delta_phy*4 delta_phy*5 delta_phy*6 delta_phy*7 delta_phy*8 delta_phy*9 delta_phy*10 delta_phy*11 delta_phy*12 delta_phy*13 delta_phy*14 delta_phy*15]; + +figure(1); +show(p); %Display Antenna +%figure(2); +% pattern(p,f,-180:30:180,0); +% pattern3Dfig = figure(2); %array pattern +% pattern(p,f); + +% Initialize counters for indexing +index = 1; +% Process and store in chunks +for i = 1:chunk_size:length(theta) + for j = 1:chunk_size:length(phi) + % Simulated computation (replace with actual pattern function) + p_val = pattern(p,f,theta(i),phi(j)); + mf.pattern_values(index, 1) = p_val; + % Store computed values directly into the MAT file (avoiding large RAM usage) + mf.theta_values(index, 1) = theta(i); + mf.phi_values(index, 1) = phi(j); + clear p_val theta(i) phi(j); + + + % Increment index + index = index + 1; + end +end + +figure(2); +patternCustom( mf.pattern_values,mf.theta_values ,mf.phi_values); +% Display confirmation message +%M = readtable("pattern_data.mat"); +%patternCustom(M(:,3),M(:,2),M(:,1)); \ No newline at end of file diff --git a/5_Simulations/Matlab/Antenna_array.m b/5_Simulations/Matlab/Antenna_array.m new file mode 100644 index 0000000..c384441 --- /dev/null +++ b/5_Simulations/Matlab/Antenna_array.m @@ -0,0 +1,40 @@ +%This Code was Written By Nemeen Shah +%Subscribe to My YouTube Channel: https://Youtube.com/NematicsLab +%Size of PCB +pcbThickness = 1.6e-3; %1.6mm +pcbLength = 152.4e-3; %152.4mm or 6inch +pcbWidth = 101.6e-3; %101.6mm 0r 4inch +%Specifying Material of PCB +pcbMaterial = 'FR4'; +pcbEpsilonR = 4.4; +%Creating dielectic Material +d = dielectric(pcbMaterial); +d.EpsilonR = pcbEpsilonR; +d.Thickness = pcbThickness; +AntennaPlane=antenna.Rectangle('Length',0.5e-2,'Width',5e-2,'Center',[0, 0]); %Creating Feed Plane of Antenna +GndPlane = antenna.Rectangle('Length',pcbLength,'Width',pcbWidth); %Creating Ground Plane of Antenna +%Creating Different Shapes of antenna +Rec = antenna.Rectangle('Length',10e-2,'Width',2e-2,'Center',[0,-20e-3]); +Rec1 = antenna.Rectangle('Length',6e-2,'Width',2e-2,'Center',[0,20e-3]); +%%Creating PCB Stack +p = pcbStack; +p.Name = 'Strip-fed slot'; +p.BoardShape = GndPlane; +p.BoardThickness = pcbThickness; +p.Layers = {AntennaPlane,d,GndPlane}; %[x Cordinate,y Cordinate,startLayer stopLayer] +p.FeedLocations = [0,(-pcbWidth/2)+6e-2,1,3]; + +%Adding all different shapes of antenna +AntennaPlane = AntennaPlane + Rec + Rec1; +p.Layers = {AntennaPlane,d,GndPlane}; +%Plotting Different patterns and graphs +figure(1); +show(p); %Display Antenna +figure(2); +pattern(p,1.943e9); %Display Radiation Pattern at 1.943GHZ +figure(3); +impedance(p,1.6e9:2e7:2.2e9); %Display Impedance Graph from 1.6GHz to 2.2GHz +freq = linspace(1.6e9, 2.2e9, 50); % Creating Frequency Vector +s = sparameters(p,freq,50); % Calalculate S11 for all frequencys +figure(4); +rfplot(s);%Diplay S11 Plot \ No newline at end of file diff --git a/5_Simulations/Matlab/DielectricCatalog.csv b/5_Simulations/Matlab/DielectricCatalog.csv new file mode 100644 index 0000000..bef885d --- /dev/null +++ b/5_Simulations/Matlab/DielectricCatalog.csv @@ -0,0 +1,18 @@ +Name,Relative_Permittivity,Loss_Tangent,Frequency,Comments +"RO4350B",4.38,0.003,12000000000,"" +"Air",1,0,1000000000,"" +"FR4",4.8,0.026,100000000,"" +"Teflon",2.1,0.0002,100000000,"" +"Foam",1.03,0.00015,50000000,"" +"Polystyrene",2.55,0.0001,100000000,"" +"Plexiglas",2.59,0.00676,10000000000,"" +"Fused quartz",3.78,0.0001,10000000000,"" +"E glass",6.22,0.0023,100000000,"" +"RO4725JXR",2.55,0.0022,2500000000,"" +"RO4730JXR",3,0.0023,2500000000,"" +"TMM3",3.45,0.002,10000000000,"" +"TMM4",4.7,0.002,10000000000,"" +"TMM6",6.3,0.0023,10000000000,"" +"TMM10",9.8,0.0022,10000000000,"" +"TMM10i",9.9,0.002,10000000000,"" +"Taconic RF-35",3.5,0.0018,1900000000,"" diff --git a/5_Simulations/Matlab/antenna16_antenna8.m b/5_Simulations/Matlab/antenna16_antenna8.m new file mode 100644 index 0000000..34ef528 --- /dev/null +++ b/5_Simulations/Matlab/antenna16_antenna8.m @@ -0,0 +1,92 @@ +% Open file to write +csvFileName = 'pattern_data.csv'; +fileID = fopen(csvFileName, 'w'); +fprintf(fileID, 'Theta,Phi,Pattern\n'); % CSV headers + +% Define angles (break into smaller chunks) +theta = -90:1:90; +phi = -180:1:180; +chunk_size = 50; + +%Size of PCB +pcbThickness = 0.508e-3; +pcbLength = 100e-3; +pcbWidth = 100e-3; + +n_array = 3; +m_array = 2; + +f = 10.5e+9; +c = 3e+8; +lambda = c/f; + +Length_patch = 8.76e-3; +Width_patch = 9.545e-3; +dist_patch = lambda/2; +feeder_width = 0.94e-3; +delta_phy = 15; %in degrees + +%Specifying Material of PCB +pcbMaterial = 'RO4350B'; +pcbEpsilonR = 3.48; +%Creating dielectic Material +d = dielectric(pcbMaterial); +d.EpsilonR = pcbEpsilonR; +d.Thickness = pcbThickness; +GndPlane = antenna.Rectangle('Length',pcbLength,'Width',pcbWidth); %Creating Ground Plane of Antenna +%Creating Different Shapes of antenna +%Rec1 = antenna.Rectangle('Length',feeder_width,'Width',dist_patch-Length_patch,'Center',[0,(dist_patch-Length_patch)/2]); %feeder +%Rec2 = antenna.Rectangle('Length',Length_patch,'Width',Width_patch,'Center',[0,(dist_patch-Length_patch)+(Length_patch)/2]); %patch + +for i=1:1:n_array + for j=1:1:m_array + Rec1 = Rec1 + antenna.Rectangle('Length',feeder_width,'Width',dist_patch-Length_patch,'Center',[(i-1)*(dist_patch),(j-1)*(dist_patch)+(dist_patch-Length_patch)/2]); + Rec2 = Rec2 + antenna.Rectangle('Length',Length_patch,'Width',Width_patch,'Center',[(i-1)*(dist_patch),(j-1)*(dist_patch)+(dist_patch-Length_patch)+(Length_patch)/2]); + end +end + + +%Adding all different shapes of antenna +AntennaPlane = Rec1 + Rec2; + +%%Creating PCB Stack +p = pcbStack; +p.Name = 'patch slot'; +p.BoardShape = GndPlane; +p.BoardThickness = pcbThickness; +p.Layers = {AntennaPlane,d,GndPlane}; +%[x Cordinate,y Cordinate,startLayer stopLayer] +% p.FeedLocations = [0,0,1,3;dist_patch,0,1,3;dist_patch*2,0,1,3;dist_patch*3,0,1,3;dist_patch*4,0,1,3;dist_patch*5,0,1,3;dist_patch*6,0,1,3;dist_patch*7,0,1,3;dist_patch*8,0,1,3;dist_patch*9,0,1,3;dist_patch*10,0,1,3;dist_patch*11,0,1,3;dist_patch*12,0,1,3;dist_patch*13,0,1,3;dist_patch*14,0,1,3;dist_patch*15,0,1,3]; +% p.FeedPhase = [0,delta_phy, delta_phy*2, delta_phy*3, delta_phy*4, delta_phy*5, delta_phy*6, delta_phy*7, delta_phy*8, delta_phy*9, delta_phy*10, delta_phy*11, delta_phy*12, delta_phy*13, delta_phy*14, delta_phy*15]; + +p.FeedLocations = [0,0.001,1,3;dist_patch,0.001,1,3;dist_patch*2,0.001,1,3]; + + +%Plotting Different patterns and graphs +figure(1); +show(p); %Display Antenna +%pattern(p,10.5e9); %Display Radiation Pattern at 10.5GHz +% Process and save in chunks +for i = 1:chunk_size:length(theta) + for j = 1:chunk_size:length(phi) + % Simulated computation (replace with actual pattern function) + p_val = rand(); % Example placeholder + + % Write to file + fprintf(fileID, '%.2f,%.2f,%.6f\n', theta(i), phi(j), p_val); + end +end + +% Close the file +fclose(fileID); + +% Display confirmation message +figure(2); +disp('Pattern data saved to CSV.'); + +% figure(3); +% impedance(p,0.8*f:0.05*f:1.2*f); %Display Impedance Graph from 1.6GHz to 2.2GHz +% freq = linspace(0.8*f, 1.2*f, 50); % Creating Frequency Vector +% s = sparameters(p,freq,50); % Calalculate S11 for all frequencys +% figure(4); +% rfplot(s);%Diplay S11 Plot \ No newline at end of file diff --git a/5_Simulations/Matlab/pattern_data.mat b/5_Simulations/Matlab/pattern_data.mat new file mode 100644 index 0000000..32a9e78 Binary files /dev/null and b/5_Simulations/Matlab/pattern_data.mat differ