66 views (last 30 days)

Show older comments

Hello everyone,

I'm having some problems with a rotation of the antenna field. Here my antenna pattern now, after a decomposition of the theta and phi fields in x,y,z-ones:

and I'd like to rotate the main lobe along the x-axis. Do you have any idea to how I shoud do it? (without the phased array toolboox - so the rotpad function- because I do not have the toolboox).

I tried applying the matrix rotation on the 3(x,y,z)-components but it just gives me a kind of "change of name". Here the results:

But as you can see the main lobe is now in the z-component (right for my purpose) but not along the x-axis.

Thank you a lot in advance.

Bjorn Gustavsson
on 8 Mar 2021

David Goodmanson
on 8 Mar 2021

Edited: David Goodmanson
on 8 Mar 2021

Hi Marina,

Since you are using surf, I am going to assume that you have three matrices x,y,z, each of size m x n, appropriate to feed into surf(x,y,z). Maybe this will help.

% simple example

thx = linspace(0,pi,40);

phix = linspace(0,2*pi,60);

[th phi] = meshgrid(thx,phix);

r = sin(th).*cos(th).*sin(phi);

x = r.*sin(th).*cos(phi);

y = r.*sin(th).*sin(phi);

z = r.*cos(th);

fig(1)

surf(x,y,z)

Rotate this through some arbitrary angles:

% rotate this through some arbitrary angles

xyz = [x(:) y(:) z(:)];

xyznew = xyz*Rxd(100)*Ryd(200)*Rzd(-300);

xnew = reshape(xyznew(:,1),size(x));

ynew = reshape(xyznew(:,2),size(x));

znew = reshape(xyznew(:,3),size(x));

surf(xnew,ynew,znew)

function M = Rxd(th)

% x rotation matrix

% angle is in DEGREES

% ccw rotation looking down at rotation axis up out of page

c = cosd(th);

s = sind(th);

M = [ 1 0 0;

0 c -s;

0 s c];

end

function M = Ryd(th)

% y rotation matrix

% angle is in DEGREES

% ccw rotation looking down at rotation axis up out of page

c = cosd(th);

s = sind(th);

M = [ c 0 s;

0 1 0;

-s 0 c];

end

function M = Rzd(th)

% z rotation matrix

% angle is in DEGREES

% ccw rotation looking down at rotation axis up out of page

c = cosd(th);

s = sind(th);

M = [ c -s 0;

s c 0;

0 0 1];

end

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

Start Hunting!