how to modify a simple program--question is 'start point not provide'

21 views (last 30 days)
I am the first to the matlab and need kind guy to see the next program that how do I to modify, thank you.
x=[1.84E-04 3.45E-04 4.81E-04 7.17E-04 9.17E-04 1.17E-03 1.51E-03 1.76E-03 2.13E-03 2.38E-03 2.70E-03 2.91E-03 3.05E-03];
>> jiaodu=[7.73E+01 7.28E+01 6.93E+01 6.42E+01 6.01E+01 5.53E+01 4.91E+01 4.45E+01 3.77E+01 3.30E+01 2.66E+01 2.23E+01 1.92E+01];
>> hudu=deg2rad(180.-jiaodu);
>> z=x./0.6;
>> G=1./z;
>> xx=G.*cos(hudu);
>> yy=G.*sin(hudu);
>> plot(xx,yy,'^')
>> zz=sqrt(xx.^2+yy.^2);
>> [xInput, yInput, zOutput] = prepareSurfaceData( xx, yy, zz );
>> ft = fittype( 'a + b*x + c*y', 'indep', {'x', 'y'}, 'depend', 'z' );
>> h= fit( [xInput, yInput], zOutput, ft);
Warning: Start point not provided, choosing random start point.
> In Warning>Warning.throw at 30
In fit>iFit at 312
In fit at 108
>> coe=coeffvalues(h);
>> aa=coe(2)/2;
>> bb=coe(3)/2;
>> r=sqrt(coe(1)+aa^2+bb^2);
>> sita=0:pi/20:2*pi;
>> hold on
>> plot(aa+r*cos(sita),bb+r*sin(sita));
>> hold on
>> plot(aa,bb,'.');
>> x1=aa-sqrt(r^2-bb^2);
>> x2=aa+sqrt(r^2-bb^2);
>> RE=1/x1;
>> RI=1/(x2-x1)

Answers (1)

Michael Haderlein
Michael Haderlein on 22 Apr 2015
It's just a warning, no big deal. Different kinds of fit algorithm exist, some need boundaries (so, the parameters can be between 0 and 100 or whatever makes sense), others need initial points to start (set the parameter to 5, see what happens, change it to 6, see what happens, and so on). Fit uses an algorithm of the latter case and needs an initial point therefore. If you don't provide one, it will just make a wild guess. Long story short, if you have any kind of idea in which region the value will be, set the initial point. If you totally have no idea at all, you can basically ignore the warning. Except that, your result might differ from execution to execution which will not be the case if you set the initial point to an arbitrary yet fixed value.

Categories

Find more on Get Started with Curve Fitting Toolbox in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!