How to do exponential curve fitting like y=a.* log(x + b.*exp(c.*x)
Mostra commenti meno recenti
Hi everybody,
I need to do nonlinear regression analysis. I have written a code for that and the function is in the form y=a.* log(x + b.*exp(c.*x). The variables a, b, c are unknowns. The matlab code is as follows.
x = load('xval.txt');
y = load('yval.txt');
f = @(b,x) b(1).*(log(x + (b(2).*exp(b(3).*x)))); % Objective Function
B = fminsearch(@(b) norm(y - f(b,x)), [2; -0.1; -5]) % Estimate Parameters
figure(1)
plot(x, y, 'pg')
hold on
plot(x, f(B,x), '-r')
hold off
grid
xlabel('x')
ylabel('f(x)')
I am unable to estimate the above parameters. Could anyone explain how to estimate [2; -0.1; -5]. But I could not fit the curve with the data. The X and Y values are attached. Like this I have 20 sets of xval and yval.
Thanks in advance.
Rajaram
Risposta accettata
Più risposte (0)
Categorie
Scopri di più su Get Started with Curve Fitting Toolbox in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!