How to find unknown constants from exponential equation
Show older comments
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.
. 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
on 11 Aug 2021
This appears to be the same problem as described (and solved) in I want to find the value of two constants from an equation with two variables
.
Niharika_dc
on 11 Aug 2021
Star Strider
on 11 Aug 2021
I did not use the Symbolic Math Toolbox in my solution. I calculated the initial parameter estimates from the data.
.
Niharika_dc
on 11 Aug 2021
Star Strider
on 11 Aug 2021
I already did that in the post that I linked to.
Niharika_dc
on 11 Aug 2021
Edited: Niharika_dc
on 11 Aug 2021
Answers (1)
Wan Ji
on 11 Aug 2021
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
Wan Ji
on 11 Aug 2021
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
Niharika_dc
on 11 Aug 2021
Niharika_dc
on 12 Aug 2021
Categories
Find more on Solver Outputs and Iterative Display in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
