Below is simple MATLAB code for 2.4GHz dipole antenna. Normally the length of this dipole is λ/2
λ=c/f
c is speed of light i.e. 300000000 m/s
And f here is 2.4GHz
And we found λ/2 to be 0.0625
We used length here to be 0.0600 since for this length we get good VSWR or we can say reflection is low.
Code:
d = dipole('Width',0.000525, 'Length',0.060) %This shows the length and width of the dipole
%You can calculate the length as per lambda/2 and then optimize according to VSWR/Reflection coefficient you get
show(d)
freq = linspace(2e9,2.7e9,51); %This is frequency sweep
figure;
pattern(d,2.4e9)
figure;
vswr(d,freq,50)
Below are the output figures
Radiation Pattern of the antenna is almost Omni-directional and it's like a donut shape.