Probably, you have used fit as a variable in your code
Try this
clear fit
x = (0:0.2:5)';
y = 2*exp(-0.2*x) + 0.1*randn(size(x));
f = fit(x,y,'exp1')
plot(f,x,y)
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!