Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Sign In with Facebook Sign In with Google Sign In with OpenID

Categories

We have migrated to a new platform! Please note that you will need to reset your password to log in (your credentials are still in-tact though). Please contact lee@programmersheaven.com if you have questions.
Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

Input Problems with LMF(Levenberg-Marquard-Formula)

searchhelpsearchhelp Posts: 2Member
Hello Matlab-Programmer!
I'm working on a Programm that gets a cooling curve of an Diode or IGBT and calculate the thermal impedance. Therefore i use an Algorithmus (Levenberg-Marquard-Algorithmus). It is called with:

[x,ssq,cnt] = LMFnlsq(res,x0);

Here is a Little Example:
--------------------------------------------------------
a = 10;
b = -8;
c = -.2; % Model parameters
t = (0:.1:1)'; % should be a column vector

f = a + b*(1-exp(t/c)) + .2*randn(size(t));

% Column vector of residuals (function)
res = @(x) x(1) + x(2)*(1-exp(t/x(3)))- f;
% solve it with rather bad estimate of parameters (start values)
x0 = [0,0];
[x,ssq,cnt] = LMFnlsq(res,x0);
plot(t,f, t,res(x)+f,'r'), grid;

------------------------------------------------------
In my Programm the function f(in the example) is a fitted function of the type cfit:
------------------------------------------------------
myfit(t) = r1*(1-exp(-t/tau1))+r2*(1-exp(-t/tau2))+r3*(1-exp(-t/tau3))
Coefficients (with 95% confidence bounds):
r1 = 82.06 (72.67, 91.45)
r2 = 12.85 (10.52, 15.17)
r3 = 82.41 (72.3, 92.52)
tau1 = 14.38 (12.25, 16.51)
tau2 = 0.06762 (0.0008762, 0.1344)
tau3 = 3.31 (2.883, 3.737)
------------------------------------------------------
As you can see the function f in the example is from type double and my function (myfit) from type cfit. But i convert it to string with "formula":
------------------------------------------------------
funktion_fit=formula(myfit);
------------------------------------------------------
I get the coefficients (of the fitted function myfit) with that calling:
------------------------------------------------------
coeff_val=coeffvalues(myfit);
coeff_fit=coeffnames(myfit);
------------------------------------------------------
But i can't convert it in a form to put it in like in the example.
The next Problem is the "function handle":
------------------------------------------------------
res=@(x) x(1) + x(2)*(1-exp(t/x(3)))-f;
------------------------------------------------------
The fucntion: x(1) + x(2)*(1-exp(t/x(3))) is in my Programm a string (dynamic). Here an example:
------------------------------------------------------
funktion_string =

'x(1)*exp(-t/(x(2)))+x(3)*exp(-t/(x(4)))+x(5)*exp(-t/(x(6)))'
------------------------------------------------------
Here is the same Problem. I can't get the string in the form like the example.

Can you help me?

Thank you
Sign In or Register to comment.