How to fit this eqation:y=a-b+*c^x ?

Hi,
I am wondering how can I fit the following equation: y=a-b+*c^x since it is not included in the library and how can I exclude some point without using the curve fitting toolbox. When I use the following expression,I receive an error message
g = fittype('a-b*c^x','coeff',{'a','b','c'})
[curve2,gof2] = fit(y2,Av,g)
Thank you in advance

6 Comments

You help those who would answer you if you show the error message that you get! Show the COMPLETE error message.
yes of course,the error message:
Warning: Start point not provided, choosing random start point. > In Warning>Warning.throw at 31 In fit>iFit at 320 In fit at 108 In projecttest6 at 155
Error using fittype>iInvalidParameterError (line 1045) The parameter "Exclude" is not valid.
Error in fittype>iEnsureValidParameterName (line 1175) iInvalidParameterError( parameter );
Error in fittype>iParseParameters (line 544) parameter = iEnsureValidParameterName( parameter );
Error in fittype>iCreateCustomFittype (line 424) obj = iParseParameters(obj,varargin(2:end));
Error in fittype>iCreateFittype (line 348) obj = iCreateCustomFittype( obj, varargin{:} );
Error in fittype (line 325) obj = iCreateFittype( obj, varargin{:} );
Error in projecttest6 (line 154) g = fittype('a-b*c^x','coeff',{'a','b','c'},'Exclude',exclude1)
Is b a scalar constant, like a, or is it a coefficient like c? You've done it both ways.
a, b, and c are all coefficients
Looking more closely I think that you meant b to be a multiplicative factor, not a scalar that you subtract and that you just made a mistake when you wrote "y=a-b+*c^x". Because of what Roger said, and you said later, I think what you really meant was y=a-b*c^x and you just put in the + sign by mistake.

Sign in to comment.

Answers (1)

Roger Stafford
Roger Stafford on 13 Dec 2013
Instead of 'a-b*c^x' you might try the equivalent 'a-b*exp(k*x)'. If you can fit to that, then c = exp(k) will be a fit for 'a-b*c^x'.

Categories

Asked:

on 13 Dec 2013

Commented:

on 13 Dec 2013

Community Treasure Hunt

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

Start Hunting!