## mardi 21 avril 2015

### Scattered data in Cartesian coordinates to Polar coordinates. Matlab

This is my problem:

I have a group of scattered data that is related to some measurements of Antenna Testing. The data is in Cartesian coordinates, and is limited by a grid of X=-7,7 and Y=-7,7. I have already interpolated the scattered data in to a grid in this way:

Matlab Code:

``````F_cp=scatteredInterpolant(X,Y,E_cpdB);
x=-7:lda/2:7;
y=-7:lda/2:7;
[x1,y1]=meshgrid(x,y);
IM_cp=F_cp(x1,y1); %Interpolation evaluated in a grid of X=Y=-7*7
```
```

Where X and Y are the scattered coordinates and E_cpdB is a Scattered vector of values (Electric Field in dB). The results of the interpolation are as expected:

[I cannot post images yet]

Now I need to interpolate and plot that Scattered data in Polar coordinates. I'm still using the same Function obtained by "scatteredInterpolant()". So this is what I've done:

``````%% Conversion to polar Coordinates
th=-2*pi:pi/16:2*pi;
ro=0:0.05:sqrt(7^2+7^2);
[th1,ro1] = meshgrid(th,ro);
[x2,y2]=pol2cart(th1,ro1);
IMp_cp=F_cp(x2,y2);
```
```

So I created a Grid with my limits in terms of Polar coordinates (TH,Ro), next that grid is converted to Cartesian, and the function of the Scattered Data is evaluated with respect to the new Grid Points. The result is not as I expect.

I have already used "interp2", I have also converted straight forward the Scattered Cartesian coordinates to Polar ones and interpolated the data. But the results are not as expected, the magnitude is changing without any reason.

For the ones that have worked with Antenna measurements, this is data extracted from FEKO related to a Compensated Compact Range measurement.

I need your ideas for the conversion of coordinates and respective interpolation. Thanks in advance!