MATLAB Answers

Fitting a profile to a Guassian Model

3 views (last 30 days)
Sarv on 30 Mar 2020
Commented: Sarv on 31 Mar 2020
Hi there, I am trying to find an expression for the parameter 'alpha' as a function of x (the length): alpha = f(x). Means that alpha must be estimated as a profile, rather than a data point. My alpha is dependent on 4 experimental and independent variables (Temperature T, Pressure P, mass flow rate m and ratio R) which each of them individually affect this profile.
I tried to use a 3rd order polynom for its description. Alpha = A x^3 + B x ^2+ C x + D.
In order to take the influence of these 4 variables on alpha values, I have written the 4 factors of A, B, C and D as:
A = a(1) * T ^ a(2) + a(3) * P ^ a(4) + a(5) * m ^ a(6) + a(7) * ratio ^ a(8) + a(9)
B = b(1) * T ^ b(2) + b(3) * P ^ b(4) + b(5) * m ^ b(6) + b(7) * ratio ^ b(8) + b(9)
C = c(1) * T ^ c(2) + c(3) * P ^ c(4) + c(5) * m ^ c(6) + c(7) * ratio ^ c(8) + c(9)
D = d(1) * T ^ d(2) + d(3) * P ^ d(4) + d(5) * m ^ d(6) + d(7) * ratio ^ d(8) + d(9)
I try to fit my experimental data with lsqnonlin, levenberg-marquardt algorithm and find the above mentioned 36 variables, so that I can have an expression for A, B, C and D, to finally predict alpha. But my problem is that: 1st: I think it’s very inefficient to use 36 parameters for a function, but I just have no better idea!! 2nd: the solver does converge and I find my 36 values (local minimum possible). But when I calculate alpha the value it gives me is going below zero (which is wrong).. and also is not really correct..
Instead I would like to use a Gaussian function to do the fit, since it describes the decaying trend of alpha better (in the attachment) and doesnt go to below zero either, but I cannot find what is the corresponding function for 'polyfit' for a Gaussian fit, and if it helps to reduce the number of the parameters and improve the accuracy..
I would greatly appreciate any comments or hints from both mathematical and coding point of view

Answers (1)

Alex Sha
Alex Sha on 31 Mar 2020
Hi, would you please upload your data file (dependent: alpha, independent variables: Temperature T, Pressure P, mass flow rate m and ratio R).
  1 Comment
Sarv on 31 Mar 2020
Hi Alex, here is a sample of my dataset. alpha changes between 1000 to 10, and 0<x<1,
thnx in advance for your help.

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!