How to find unknown constants from exponential equation

I am trying to find the value of the unknown constants a,b,c from the equation, . Here x and t are variables, the data points of which are available to me.
The equation available with me is a complex one, so to simplify it I have considered the combination of the unknown constants as a,b and c and have tried to find the final constants by solving a, b and c. I have tried solving it like this. For the initial parameters, I used the curve fitting toolbox to get approximate values of a,b and c. Is the approach I used correct? Is there any other way to solve this problem?
clc
clear
v = xlsread('Book1.xlsx');
x=v(:,2);
t=v(:,1);
x = @(p,v) p(1).*v(:,1)-p(2)*exp(-p(3).*v(:,1))+p(2);
p0=[0.2493;155.4;382.4]; %initial parameter
SSECF = @(p) sum((v(:,2) - creep(p,v)).^2);
[abc, SSE] = fminsearch(SSECF, p0);
a = abc(1)
b = abc(2)
c = abc(3)
syms e n1 n2
eqns=[6/(n1+n2)==a;6*n2^(2)/(e*(n1+n2)^2)==b;e*(n1+n2)/(n1*n2)==c];
S=vpasolve(eqns,[e n1 n2]);
E=S.e
N1=S.n1
N2=S.n2

6 Comments

@Star Strider I looked at the answer. The problem is, in this particular equation, to find the initial parameters, vpasolve does not work. It returns 0x1 matrix. So, I tried finding the initial guesses of the coefficients using the curvefit toolbox. But I am unable to fit this equation properly to the graph.
I did not use the Symbolic Math Toolbox in my solution. I calculated the initial parameter estimates from the data.
.
@Star Strider Hi. Sorry to trouble you, but can you show me how I can solve this problem to find the coefficients.
I already did that in the post that I linked to.
@Star Strider In my case, there are 3 unknown constants. I did not understand how p0(1),p0(2),p0(3) in this case was estimated and how I can estimate p0(1),p0(2),p0(3) and p0(4) in my case
p0(1) = sigma0/x(end); % Estimate 'E' (Asymptote = 'x(end)')
p0(2) = tau; % Extimate 'eta'
p0(3) = min(x) % Offset

Sign in to comment.

Answers (1)

Your code is ok, but the nonlinear model function may not so well selected!
clear
v = xlsread('Book1.xlsx');
x=v(:,2);
t=v(:,1);
creep = @(p,v) p(1).*v(:,1)-p(2)*exp(-p(3).*v(:,1))+p(2);
p0=[1.2493;155.4;382.4]; %initial parameter
SSECF = @(p) sum((v(:,2) - creep(p,v(:,1))).^2);
[abc, SSE] = fminsearch(SSECF, p0);
a = abc(1)
b = abc(2)
c = abc(3)
vfit = creep(abc,v(:,1));
plot(v(:,1),v(:,2)); hold on
plot(v(:,1), vfit)

6 Comments

Comment posted as answer by @sakura w:
@Wan Ji I am actually very new in matlab and don't know how exactly we can find a best fit curve. Can you please show me how I can find a better fit for the graph? Thanks in advance!
If I chose a curve to fit the data from the xlsx file given above, I will think about sigmoid function or atan function.@Rik Then unknown constants a,b,c from the equation becomes
The process goes like this
clc
clear
v = xlsread('Book1.xlsx');
x=v(:,2);
t=v(:,1);
creep = @(p,v) p(1) + p(2)./(p(3)+exp(v));
p0=[150;1;1]; %initial parameter
SSECF = @(p) sum((v(:,2) - creep(p,v(:,1))).^2);
[abc, SSE] = fminsearch(SSECF, p0);
vfit = creep(abc,v(:,1));
plot(v(:,1),v(:,2)); hold on
plot(v(:,1), vfit)
legend('v_{true}', 'vfit')
abc
abc =
1.0e+02 *
1.571957937131152
-0.037093446443334
-0.003146940957768
@Wan Ji Hi. I actually need to fit the given equation to the curve obtained by plotting the points of (t,x) and then find the values of the constants a,b and c.
@sakura w Hey, friend! I have tried the equation , and it works well, the equation you provide may be wrong.
creep = @(p,v) p(1) + p(2)*(1-exp(-p(3)*v));
As you know the constant item b should be independent (but indeed in your equation it is dependent), so linear item is therefore not necessary here. That's why I change to a.@sakura w (In order to keep the completeness of primary functions [1, , nonlinear constant c ])

Sign in to comment.

Asked:

on 11 Aug 2021

Commented:

on 12 Aug 2021

Community Treasure Hunt

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

Start Hunting!