MATLAB: Which curve fitting function do I need

curve fittingoptimization

I want to fit the following function to measured data in order to estimate R:
D = atan2(sin(H),R*cos(H))
I have measured H & D
H will be in the range -1.1*pi/2 to 1.1*pi/2
I expect R to be approximately +2
To visualize, see:
figure
H = [-1.1*pi/2:0.1:1.1*pi/2]';
R = 2;
D = atan2(sin(H),R*cos(H));
plot(H,D)
I don't know which curve-fitting function to use. I have access to both the curve-fitting and optimization toolboxes. Any advice would be much appreciated.
Thanks

Best Answer

lsqcurvefit() % optimization toolbox
or
lsqnonlin()