MATLAB: Need to solve the equation to find ABC Values

isqcurvefit

Equation:
y = A (exp(Bx)-exp(-Cx))
x=[-0.5 -0.4 -0.3 -0.2 -0.1 0 0.1 0.2 0.3 0.4 0.5];
y=[-2.2026 -0.2981 -0.0403 -0.0055 -0.0007];
to find A B C Values

Best Answer

Hi,
x and y do not have the same length - if i assume, that y = -2.2026 belongs to x=-0.5 and so on you can determine the values for A, B and C as follows:
%x=[-0.5 -0.4 -0.3 -0.2 -0.1 0 0.1 0.2 0.3 0.4 0.5]';
x=[-0.5 -0.4 -0.3 -0.2 -0.1]';
y=[-2.2026 -0.2981 -0.0403 -0.0055 -0.0007]';
fun = fittype(@(A, B, C, x)(A.*(exp(B.*x)-exp(-C.*x))));
[fitobject,gof,output] = fit(x, y, fun)
ABC = coeffvalues(res)
This assumes that you have the Curve Fitting Toolbox.
Best regards
Stephan