MATLAB: How to force a exponential fit to go through a preestablish point (x,y)

exponential fitfitting

Hi, I have some data X and Y and I want to fit it to an exponential function but giving it an initial point (Xo,Yo):
f = fit(x,y,'exp1','StartPoint',[0 2])
Is there any way to do it? I think I've tried everything I could.

Best Answer

x0 = ...; % x coordinate of preestablished point
y0 = ...; % y coordinate of preestablished point
g = @(p,x)y0*exp(-p*(x-x0));
f = fit(x,y,g)
plot(f,x,y)