A. Please find the corrected code below.

```
clc
clear
clear all
close all hidden
f=input('Please enter operating frequency in Hz :\n–>');
N=input('Please enter no of elements(N) :\n–>');
disp('Press any key to see the value of wavelength lambda in meters:')
pause
disp('==============================================================')
lambda=(3e8)/f %lambda=c/f %The value is in meters
disp('=========================================')
disp(' ')
pause
d=input('Please enter distance d in meters between elements :\n–>');
K=2*pi/lambda;
theta=0:0.01:180;
U=(0.5*K*d)*cos(theta*pi/180);
R0db=input('Please enter side lobe ratio in db :\n–>');
c=chebwin(N,R0db);
b=c';
x=mod(N,2);
if x==0;
for i=1:(N/2);
a(i)=b((N/2)+i);
end
elseif x~=0;
for i=0:floor(N/2);
a(1+i)=b(round(N/2)+i);
end
end
if x==0;
AF=0;
for n=1:N/2;
AF=AF+a(n).*cos(((2*n-1))*U);
end
elseif x~=0;
AF=0;
for n=1:round(N/2);
AF=AF+a(n).*cos((2*(n-1))*U);
end
end
figure
plot(theta,abs(AF))
title('Pattern of array in linear scale');
AFdb=20*log10(abs(AF));
figure
plot(theta,AFdb)
title('Pattern of array in db scale');
figure
polar(theta*pi/180,abs(AF));
title('Polarization Factor Vs theta');
```

]]>Can provide any hint on how we can do this in Matlab?

Thank you

]]>