Suppose I wish to fit some data to a simple exponential model. I'll make up some data, then add moderate noise to the data.
X = rand(50,1)/10;
a0 = 3; % ground truth coefficients
b0 = 0.5;
c0 = -20;
Y = a0 + b0*exp(c0*X) + randn(size(X))/40;
plot(X,Y,'o')
grid on
xlabel X
ylabel Y

Note that data with high noise is often a difficult problem. Large residual nonlienar least squares problems will often be poorly convergent. You will then need GREAT starting values to have a chance at a fit, but also robust methods may help, perhaps using an iterative scheme that downweights the data points with the largest residuals. (Commonly known as iteratively reweighted nonlinear least squares.)
The data I show above is not too bad. There is a reasonable signal present, certainly so in context of the amount of data. Having too little data is a VERY common problem. However, I can only remember one client over many years of consulting I ever came across where they willingly gave me more data than I wanted.
So imagine we wish to fit the curve above using the curve fitting toolbox? Surely this is a simple problem, and the CFTB should hve no problem at all in the fit.
mdl = fittype('a + b*exp(c*x)','indep','x');
fittedmdl = fit(X,Y,mdl)
Warning: Start point not provided, choosing random start point.
fittedmdl =
General model:
fittedmdl(x) = a + b*exp(c*x)
Coefficients (with 95% confidence bounds):
a = 205.5 (-8.241e+04, 8.282e+04)
b = -202.1 (-8.282e+04, 8.241e+04)
c = 0.01938 (-7.894, 7.933)
Hmm. WHAT THE HECK HAPPENED? I expected something close to the parameters [3,1,-20] for [a,b,c]. Where did I go wrong?
plot(fittedmdl)
hold on
plot(X,Y,'o')
grid on
xlabel X
ylabel Y
hold off

The problem is I gave it no starting values for the parameters. And worse, I gave it a model with implicitly the WRONG sign on the exponential rate parameter, thus c. We would expect to see a model with a NEGATIVE parameter c. But the starting value for c was by default, positive. The CFTB, when given no information about the starting values, uses a random start point, in the interval [0,1], as I recall.
But, surely fit is smart enough to find -20 for c? In fact, what you should see is that fit chose a very small, but still positive value for c. The problem is that the fundamental shape of that exponential term changes as we swap signs for c.
fplot(@(x) exp(-x),[-1,1])
hold on
fplot(@(x) exp(x),[-1,1])
legend('Negative exponential','Positive exponential')

Those two curves have fundamentally different shapes. An optimizer is a dumb thing, It does not understand that as soon as you swap the sign inside that exponential, the curve changes shape. And so, it tries to make the exponential rate parameter something that fits the data as well as it can, but it never tries to change the sign! (Some days, you might get lucky, but not here.)
The trick of course, is to just give it a starting point that gives it a chance to converge to a reasonable solution.
fittedmdl2 = fit(X,Y,mdl,'start',[1 1 -1])
fittedmdl2 =
General model:
fittedmdl2(x) = a + b*exp(c*x)
Coefficients (with 95% confidence bounds):
a = 3.02 (2.98, 3.06)
b = 0.4877 (0.4537, 0.5218)
c = -21.61 (-26.12, -17.11)
That seems to have worked amazingly well. As you can see here, I did not try very hard to give it intelligent starting coefficients. But I did give it the correct sign for c. Had I screwed up the signs for a or b, that probably would not have been an issue.
figure
plot(fittedmdl2)
hold on
plot(X,Y,'o')
grid on
xlabel X
ylabel Y
hold off

There are similar problems that arise for trigonometric models. Again, it is the rate parameters that seem to be most problematic. For example...
X2 = rand(250,1)*10;
abcd0 = 2 + 3*rand(1,4) % this time, I'll use random ground truth parameters
abcd0 = 1×4
3.5357 4.6951 3.8206 4.3103
Y2 = abcd0(1) + abcd0(2)*sin(abcd0(3)*X2 + abcd0(4)) + randn(size(X2))/10;
figure
plot(X2,Y2,'o')
grid on

Honestly, that seems like pretty easy data to fit, right? This is a clear sine wave. I have lots of data. What could possibly go wrong?
mdlS = fittype('a + b*sin(c*X + d)','indep','X')
mdlS =
General model:
mdlS(a,b,c,d,X) = a + b*sin(c*X + d)
fittedmdlS = fit(X2,Y2,mdlS)
Warning: Start point not provided, choosing random start point.
fittedmdlS =
General model:
fittedmdlS(X) = a + b*sin(c*X + d)
Coefficients (with 95% confidence bounds):
a = -31.73 (-1.439e+05, 1.438e+05)
b = 34.94 (-1.438e+05, 1.439e+05)
c = 0.02722 (-56.15, 56.2)
d = 7.676 (-359.1, 374.4)
figure
plot(fittedmdlS)
hold on
plot(X2,Y2,'o')

And those coefficient estimates are clear crap. What went wrong again? When we change the scale parameter ( c) here, a sine wave undergoes fundamental changes, ones that fit simply does not understand. So if we start c in the wrong place, fit is never able to escape what is a locally sub-optimal solution. But if I start the fit with something reasonable, then it has a chance to converge.
abcdstart = [mean(Y2),(max(Y2) - min(Y2))/2,2*pi/10*6,pi]
abcdstart = 1×4
3.0789 4.8770 3.7699 3.1416
fittedmdlS2 = fit(X2,Y2,mdlS,'start',abcdstart)
fittedmdlS2 =
General model:
fittedmdlS2(X) = a + b*sin(c*X + d)
Coefficients (with 95% confidence bounds):
a = 3.533 (3.52, 3.546)
b = 4.687 (4.67, 4.705)
c = 3.82 (3.819, 3.821)
d = 4.312 (4.304, 4.319)
figure
plot(fittedmdlS2)
hold on
plot(X2,Y2,'o')
xlabel 'X2'
ylabel 'Y2'
grid on

Better starting values often help a huge amount.
I often compare an optimizer to setting a blind person down on the face of the earth, and asking them to find the point with the lowest (or highest elevation.) Given only a cane, and the ability to know the local shape of the surface, will they have any chance of success, at least if you start them out in a strange, random place?