Matlab中的ezplot函数输入错误

时间:2020-01-19 13:16:50

标签: matlab

我收到消息 '输入必须为字符串表达式,函数名称,函数句柄或INL'。 “ E”确实是Theta的功能。该代码附在下面。不同的Theta值的E字段值显示在命令窗口中,但未绘制。我该怎么办?

%The script aims to plot the 2D radiation pattern of an antenna array
%The constants used are f,c,k,dx,dy,q,M,N,focal and phi 
%Electric field varies only with Theta
f = input('Enter the input frequency in GHz ');
c = 3*(10^8); %speed of light, constant
k = (2*180*(f*1e9))/c; %computes wavenumber
dx = input('Enter the row-wise inter-element spacing ');
dy = input('Enter the column-wise inter-element spacing ');
q = input('Enter q for cosine power radiation pattern of horn ');
focal = input('Enter the focal length ');
M = input('Enter the number of rows: M ');
N = input('Enter the number of columns: N ');
Phi = 0; % We take phi as zero
Theta = -90:1:90; %angle varies from -pi/2 to +pi/2
%syms Theta Phi
% Array factor is dependent only on Theta and not on phi
AFtot= 0; % Initializing the total array factor to zero
for m = (-M+1) : M
    for n = (-N+1): N
        Rmn = sqrt((((m-0.5)*dx)^2) + (((n-0.5)*dy)^2) + (focal^2));
        Rr = sin(Theta)*dx*(m-0.5); %Rr is the dot product of rmn vector and rcap vector
        Phimn = (k*(Rmn-Rr))- 2*180; %Computes phimn
        E = exp(1i*(Phimn+Rr-(k*Rmn)));
        AF = E.*((cos(Theta)).^q)/Rmn;
        AFtot = AFtot + AF;
    end
end
E = AFtot.*cos(Theta); %Computes the Electric field pattern
disp(E);
ezplot(E);

0 个答案:

没有答案
相关问题