Hi all,
I am trying to interpolate between these points, ideally I'd like to have a smooth"ish" curve passing through the points. I'm not sure how to proceed.
I have tried to convert the data to polar coordinates and use interp1:
[thi,ki]=cart2pol(xi,yi);dth=0.01th_int=-pi:dth:pki_int= interp1(thi,ki ,th_int,'pchip','extrap');
But I've been getting the "The grid vectors must contain unique points." error. I then tried a different approach by fitting a smoothing spline to the polar data.
cfit=fit(thi',ki','smoothingspline')ki_int = feval(cfit,th_int)';
It seems to work pretty well, but if I transform it back to Cartesian coordinates
[xint,yint]=pol2cart(th_int,ki_int);
I get the following figure: the fit is good except in that one region.
Any help would be greatly appreciated, it seems like it should be a fairly easy problem to solve but I can't figure it out.
Thanks,
Clemence
Ps: I'm using the R2016a academic version and I have the curve-fitting toolbox.
Best Answer