Curve fitting multiple parameters function

6 views (last 30 days)
Hello,
I have a set of data that fits a defined curve fitting function model as
I = a*exp(-bx)+c;
the parameters a, b and c depends on a function r, say (a,b,c) = f(r)
My defined function I also depends on another parameter k , say (a,b,c) = f(k)
How can I define single function that that depends on both k and r, say
I = f(a,b,c)
I = a*exp(-bx)+c
(a,b,c) = f(k,r)
Thank you
  2 Comments
Sambit Supriya Dash
Sambit Supriya Dash on 15 Aug 2021
Could you elaborate more the question with funs. or with some similar examples ?
Kabir Shariff
Kabir Shariff on 15 Aug 2021
I want to develop an analytical modelfor turbulence from numerical sumulation data. I know the turbulence depends on three different parameters, the thrust const (r) , the ambient const (k) and the position (x).
I use an exponential function model to fit the numerical data as shown in the figure
The model equation is of the form
I = a*exp(-bx)+c;
where a, b and c are linear functions that depend on the ambinent const (k),
I maintain a value of r and simulate for different values of k to have different values of (a,b and c) to develop a relation. e.g
The same model is also used to obtain a similar parameters a, b, and c that depends on the thrust coeffcient (r) ( keeping k constant)
I want to to have an expression that combines both r and k in a, b and c parameters something like

Sign in to comment.

Answers (1)

Sulaymon Eshkabilov
Sulaymon Eshkabilov on 16 Aug 2021
You can write a function file or function handle, e.g.:
F=@(k, r, x)(2*r*k*exp(0.576*k*x)+c); % etc.
% OR
function F = MyFun(k,r, x)
F = (2*r*k*exp(0.576*k*x)+c);
end
  2 Comments
Kabir Shariff
Kabir Shariff on 17 Aug 2021
I think the function handle will not do the job.
I dont have the model with variation of both r and k, but I have a model for each separate variable (i.e model eqn for r and model eqn for k)
I want to have a single model that account for both variables
NB: the equations given are for example purpose
Kabir Shariff
Kabir Shariff on 18 Aug 2021
Hello,
I would like to give more calrification on my case please.
  1. My objective is to develop analytical model from a measured data for range of k and r
My measured data is dependent on both thrust const (r) and ambient constant (k) and varies along x
r = [0.64 0.89 0.98];
k = [0.08 0.15 0.2 0.23];
I use a defined model equation to fit the data; my model equation of the form;
I = a*exp(-bx)+c;
2. with cftool, I fix r say 0.64, and find the parameters a, b, and c in the model equation for all values of k ( meaning i have 4 different values of a,b, and c correspoding to k)
3. I repeat the same step for r = 0.89 and r = 0.98 (each case obtaining a different coefficent of the model equation)
4. Then, I ploted k Vs a, k vs b and k vs c. to obtain the relationship between k and (a,b,c) which is linear relation
5. I did a similar plot this time with r, say r vs a, r vs b and r vs c ( also obtaining a linear dependance)
6. I have two different models, one with variable r (k constanrt) and the other with variable k (r constant)
Is there any way to optimize the model to be in the form?
I = a*r*kexp(-b*kx)+c*r;
for 0.064 < r < 0.98;
0.08 < k < 0.23
a, b,c constant
Thank you in advance

Sign in to comment.

Products


Release

R2019a

Community Treasure Hunt

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

Start Hunting!