Info

This question is closed. Reopen it to edit or answer.

I need help with my program.when I run it either in broadside or endfire,am not able to plot the array factor which ends up in a straightline & I need to sort this out sn.I'm also attaching the file whose values are used in this prog.Matlab ver 2008b

1 view (last 30 days)
clc; clear all; close all; amp=1; j=sqrt(-1); [idpat]=xlsread('freqrad.xlsx',2,'B3:B1500'); % Importing the element pattern values [rad]=xlsread('freqrad.xlsx',2,'A3:A1500'); % Importing the radian values fid=fopen('C:\Users\elcot\Documents\MATLAB\freqrad.xlsx'); rad=rad'; idpat=idpat'; [i j]=size(rad); g = zeros(i,j); a = zeros(i,j); ab=input('Enter the number of elements \n','s'); N=str2double(ab); %no. of elements frequency=input('Enter a frequency (MHZ) \n','s'); lamdavalue=(3*10^2)/str2double(frequency); fprintf('The wavelength is %d \n',lamdavalue); %wavelength value spacing=input('Enter the value of d in terms of wavelength \n','s'); Dinlamda=str2double(spacing)*lamdavalue; %Spacing in lamda conversion typ=input('Enter the type of radiation pattern: a.broadside b.endfire\n','s'); if (typ=='a') theta_zero=90; %Broadside radiation pattern. for k=1:1:j g(k) = (idpat(k)); %Imported element pattern values. for n=0:N-1 f(k) =abs( f(k)+ amp*exp(j*n*2*pi*Dinlamda(cos(rad(k))-cos(theta_zero*pi/180))))* ;% Array factor values end F(k) = (g(k)*a(k)); % Total radiation pattern. end
else theta_zero=0; % Endfire radiation pattern for k = 1:1:1439 g(k) = (idpat(k)); %Imported element pattern values. for n=0:N-1 f(k) =abs( f(k)+ amp*exp(j*n*2*pi*Dinlamda(cos(rad(k))-cos(theta_zero*pi/180)))) ;* % Array factor values end F(k) = abs(g(k))*(f(k)); % Total radiation pattern. end end
subplot(2,2,1) plot(rad,g) title('Element Pattern of Dipole');
subplot(2,2,2) plot(rad,a) title('Array Factor');
subplot(2,2,3) plot(rad,F) title('Total Pattern of Dipole');

Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!