MATLAB: Interpolation of Antenna radiated power with respect to Phi(angels)

antennainterpolationMATLABpower

Hello everyone
i attached a mat file containing antenna radiated power, the file contains three columns the first one is the theta and second one is the phi and third one is the power in db
The problem that the second column from -180 to 175 and every 5 steps like that(-180:5:175) what i need to be every degree like (-180:1:180) and of course i need the power so it will be with interpolation, i tried alot but failed to do it, please your support.
Thanks.

Best Answer

To interpolate only with respect to ϕ, try this:
D = load('antenna radiated power.mat');
theta = D.Data1(:,1);
phi = D.Data1(:,2);
pwrdB = D.Data1(:,3);
[Uphi, ia, ic] = unique(phi); % Find Grid Cycles
rpts = diff(ia); % Find Grid Cycles Length
thetam = reshape(theta, rpts(1), []); % Reshape To Matrix


phim = reshape(phi, rpts(1), []); % Reshape To Matrix
pwrdBm = reshape(pwrdB, rpts(1), []); % Reshape To Matrix
phiqv = linspace(min(phi), max(phi), 356); % Interpolation Vector: phi

[phiqm,thetaqm] = ndgrid(phiqv, thetam(:,1)); % Interpolation Matrices

pwrdBqm = griddata(phim, thetam, pwrdBm, phiqm, thetaqm); % Interpolated Matrix)

To also interpolate with respect to θ, replace the last three lines in this code with these four lines:
phiqv = linspace(min(phi), max(phi), 356); % Interpolation Vector: phi
thetaqv = linspace(min(theta), max(theta), 181); % Interpolation Vector: theta
[phiqm,thetaqm] = ndgrid(phiqv, thetaqv); % Interpolation Matrices
pwrdBqm = griddata(phim, thetam, pwrdBm, phiqm, thetaqm); % Interpolated Matrix)
To view the interpolated matrices in Cartesian coordinates:
figure
plot3(thetaqm, phiqm, pwrdBqm, '.')
grid on
and to view them in polar coordinates:
[X,Y,Z] = sph2cart(thetaqm, phiqm, pwrdBqm);
figure
plot3(X, Y, Z, '.')
grid on
or:
figure
scatter3(X(:), Y(:), Z(:), 10, Z(:), '.')
grid on
Those should do what you want.