On Wednesday, January 29, 2014 2:11:43 AM UTC-6, mra...@gmail.com wrote:
> Well, the (theta) and phi are the angles I run the algorithm over. So the goal is to cover all phi/theta angles from -1 to 1 (scaled with pi/2) and then plot them.
Sorry for the delay, I'm giving exams this week, and am a bit busy. I'm trying to determine what you're trying to do. For example, I use the following Matlab code to plot array patterns. It gives me array gain as a function of azimuth for a linear array. For a 2-dimensional array, the general display is still array gain as a function of azimuth, but the array structure must be accounted for.
function [x,y,r,a] = PolarPlot(N,D,S)
% Function to plot an phased-array antenna pattern
% Gives normalized field pattern in polar and rectangular coordinates
%
% plot(x,y) gives plot using rectangular coordinates
% polar(a,r) gives plot using polar coordinates
%
% N = number of sources
% D = spacing, in wavelengths, of the sources
% S = phasing of the sources, in radians (e.g., 90 degree = 1.57)
y = [];
x = [];
cd = 6.28*D;
j = 1;
a = .01:.01:6.27;
ca = cos(a);
pf = cd*ca + S;
r = sin(N*pf/2)./sin(pf/2);
r = abs(r);
y = r.*ca;
x = r.*sin(a);
end
From your code, it appears that you are trying to plot 3-dimensional data on a 2-dimensional surface, much like the information displayed in a spectrogram. What do you think the display should look like?
Reply by mrab...@gmail.com●January 29, 20142014-01-29
Well, the (theta) and phi are the angles I run the algorithm over. So the goal is to cover all phi/theta angles from -1 to 1 (scaled with pi/2) and then plot them.
Reply by mrab...@gmail.com●January 29, 20142014-01-29
On Tuesday, January 28, 2014 11:32:14 PM UTC+1, maury wrote:
> On Tuesday, January 28, 2014 2:37:24 AM UTC-6, mra...@gmail.com wrote: > Hi, > > > > I've been trying lately to plot an 2D array beamforming diagram, pointing in a direction ele and az as a function of the incident angle. From the textbooks I've managed to understand that to plot the array pattern as a function of the incidence angle then the array pattern value depends on the difference of the sines rather than the difference of the angles themselves. At least for an D array. > > I've been trying to expand this to an 2D array using u=sin()*cos() and > > v=sin()*sin() and taking the difference between that and the pointing > > angle, however, it simply does not seem to work out. > > > > The matlab code looks something like this: > > > > ele=0; az=0; % array pointing direction > > lambda=2; w=[1 1 1 1 1]; % lambda / array weights > > xpos=[1 1 1 1 1]; ypos=[1 2 3 4 5]; % position of elements > > step=0.01; > > > > pattern=[]; > > pu=xpos*cos(ele); > > pv=ypos*cos(az); > > c1=1; fx=-j*2*pi/lambda; > > for phi=-1:step:1 > > c2=1; > > for the=-1:step:1 > > af=0; > > k=[sin(0.5*pi*phi)*cos(0.5*pi*the)-sin(ele)*cos(az) sin(0.5*pi*phi*sin(0.5*pi*the)-sin(ele)*sin(az) 0]; > > for m=1:length(w) > > af=af+w(m)*exp(fx*k*[pu(m); pv(m); 0]); > > end; > > pattern(c1,c2)=af; > > c2=c2+1; > > end; > > c1=c1+1; > > end; > > imagesc(abs(pattern)) > > > > I guess I'm simply doing an incorrect rotation or adding up something > > incorrectly in the k=[] line. Could anyone please shed more light and helpe me fix this ? I think if i just replace in the following k=[u-2*ele/pi v-2*az/pi 0]; then I get the plot in the wavenumber domain which seem to be OK, but in a real life situation I want to plot it as > > a function of the incidence angle. > > > > Thank you. What is _the_ in the line beginning with k=[sin(0.5*pi*phi)*cos(0.5*pi*the)-sin(ele)*cos(az)
Well, the (theta) and phi are the angles I run the algorithm over. So the goal is to cover all phi/theta angles from -1 to 1 (scaled with pi/2).
Reply by maury●January 28, 20142014-01-28
On Tuesday, January 28, 2014 2:37:24 AM UTC-6, mra...@gmail.com wrote:
> Hi,
>
>
>
> I've been trying lately to plot an 2D array beamforming diagram, pointing in a direction ele and az as a function of the incident angle. From the textbooks I've managed to understand that to plot the array pattern as a function of the incidence angle then the array pattern value depends on the difference of the sines rather than the difference of the angles themselves. At least for an D array.
>
> I've been trying to expand this to an 2D array using u=sin()*cos() and
>
> v=sin()*sin() and taking the difference between that and the pointing
>
> angle, however, it simply does not seem to work out.
>
>
>
> The matlab code looks something like this:
>
>
>
> ele=0; az=0; % array pointing direction
>
> lambda=2; w=[1 1 1 1 1]; % lambda / array weights
>
> xpos=[1 1 1 1 1]; ypos=[1 2 3 4 5]; % position of elements
>
> step=0.01;
>
>
>
> pattern=[];
>
> pu=xpos*cos(ele);
>
> pv=ypos*cos(az);
>
> c1=1; fx=-j*2*pi/lambda;
>
> for phi=-1:step:1
>
> c2=1;
>
> for the=-1:step:1
>
> af=0;
>
> k=[sin(0.5*pi*phi)*cos(0.5*pi*the)-sin(ele)*cos(az) sin(0.5*pi*phi*sin(0.5*pi*the)-sin(ele)*sin(az) 0];
>
> for m=1:length(w)
>
> af=af+w(m)*exp(fx*k*[pu(m); pv(m); 0]);
>
> end;
>
> pattern(c1,c2)=af;
>
> c2=c2+1;
>
> end;
>
> c1=c1+1;
>
> end;
>
> imagesc(abs(pattern))
>
>
>
> I guess I'm simply doing an incorrect rotation or adding up something
>
> incorrectly in the k=[] line. Could anyone please shed more light and helpe me fix this ? I think if i just replace in the following k=[u-2*ele/pi v-2*az/pi 0]; then I get the plot in the wavenumber domain which seem to be OK, but in a real life situation I want to plot it as
>
> a function of the incidence angle.
>
>
>
> Thank you.
What is _the_ in the line beginning with
k=[sin(0.5*pi*phi)*cos(0.5*pi*the)-sin(ele)*cos(az)
Reply by mrab...@gmail.com●January 28, 20142014-01-28
Hi,
I've been trying lately to plot an 2D array beamforming diagram, pointing in a direction ele and az as a function of the incident angle. From the textbooks I've managed to understand that to plot the array pattern as a function of the incidence angle then the array pattern value depends on the difference of the sines rather than the difference of the angles themselves. At least for an D array.
I've been trying to expand this to an 2D array using u=sin()*cos() and
v=sin()*sin() and taking the difference between that and the pointing
angle, however, it simply does not seem to work out.
The matlab code looks something like this:
ele=0; az=0; % array pointing direction
lambda=2; w=[1 1 1 1 1]; % lambda / array weights
xpos=[1 1 1 1 1]; ypos=[1 2 3 4 5]; % position of elements
step=0.01;
pattern=[];
pu=xpos*cos(ele);
pv=ypos*cos(az);
c1=1; fx=-j*2*pi/lambda;
for phi=-1:step:1
c2=1;
for the=-1:step:1
af=0;
k=[sin(0.5*pi*phi)*cos(0.5*pi*the)-sin(ele)*cos(az) sin(0.5*pi*phi*sin(0.5*pi*the)-sin(ele)*sin(az) 0];
for m=1:length(w)
af=af+w(m)*exp(fx*k*[pu(m); pv(m); 0]);
end;
pattern(c1,c2)=af;
c2=c2+1;
end;
c1=c1+1;
end;
imagesc(abs(pattern))
I guess I'm simply doing an incorrect rotation or adding up something
incorrectly in the k=[] line. Could anyone please shed more light and helpe me fix this ? I think if i just replace in the following k=[u-2*ele/pi v-2*az/pi 0]; then I get the plot in the wavenumber domain which seem to be OK, but in a real life situation I want to plot it as
a function of the incidence angle.
Thank you.