Hello all,
Been a while since I used matlab so a little rusty, but can't seem to figure out the fit function. I keep getting the error
Error using fittype>iAssertIsMember (line 1084)
Coefficient gc does not appear in the equation expression.
Here is my code-
t = [1,4,6]';gsy = [0,5,20]';gfsx = [2,4,6]';gfsy = [0,3,15];fitfun = fittype( @(gc,gu,gd,x) D(x) );[fitted_curve,gof] = fit(gsx,gsy,fitfun)coeffvals = coeffvalues(fitted_curve);scatter(gsx, gsy, 'r+')hold onplot(gsx,fitted_curve(x))hold off
where
D(x) =
(20*gc*exp(gd*x))/(gc + gd – gu) – (20*gc*exp(-x*(gc – gu)))/(gc + gd – gu)
which was solved in previous code.
I am using R2020b version. Thank you!
Best Answer