Fitting complex function to a model and determining variables

5 views (last 30 days)
Hello,
I have measured data (<http://www.ds-es.com/mtlb/data.txt>) and from first two rows of them I have graph (<http://www.ds-es.com/mtlb/graf.png)>. This data i have to fit on a complex function - Re + j*2000*pi*Le + (1/Rm+j*2000*pi*Mm+(1/j*2000*pi*Cm)). I need to do it by Least Squares method.
I need to fit data to this function and determine variables Re, Le, Rm, Mm and Cm. Please do you have tips for me or you just know how to do it cause I am lost in it.
Thanks for all answers, I really appreciate it.

Answers (1)

John D'Errico
John D'Errico on 26 Oct 2015
1. This is NOT a complex function. It is a quite simple function. It is linear in the parameters you tell us are unknowns, though nonlinear in the only variable you do not mention: j.
2. The function you show will not even come remotely close to fitting a curve of the type you show.
3. If I DID show you how to fit that model to your data, it would be a waste of time, since you will need a nonlinear model and therefore a nonlinear regression. The model that you show is linear in the unknown parameters, so in fact, a simple multiple linear regression would suffice to fit it. Again, a waste of your time to try for the reasons I've outlined.
4. The model you show will not even be uniquely estimable using linear (or nonlinear) regression, no matter how many data points you have, since two pairs of the parameters are such that you can choose ANY value for one member of that pair, and only then be able to estimate the other parameter. That is, you can choose ANY number for Rm, and only then will you be able to estimate Re. Similarly, Le and Mm are similarly confounded.
I'm sorry, but whatever source told you this is the proper model for the curve you plotted, it is (or they are) simply flat out wrong. It cannot produce a curve with the shape that you show in the plot.
Please ask again when you choose a better choice of model form.
  2 Comments
John D'Errico
John D'Errico on 26 Oct 2015
Yes. I know that somebody else will probably come along and try to tell you that you can use one of: fminsearch, backslash, fit, nlinfit, lsqnonlin, lsqcurvefit, lsqlin, lscov, regress, or any of a number of other tools to solve your problem. They would all be wrong for several reasons as I outline above.
You need to choose a model that is capable of fitting the curve that you show. That model must have parameters that are NOT confounded as I describe above, or else you will get essentially nonsense results, then causing you to post again with an anguished question about why does some specific curvefitting tool fail.
Once you do choose a viable model, only then will it make sense to show you how to fit that model. You will also need to tell us which toolboxes you have access to, since there are tools in at least 3 different toolboxes that can help you, thus the curvefitting, statistics, or optimization toolboxes.
John D'Errico
John D'Errico on 26 Oct 2015
Ok, I have a few short minutes to expand on some of the points I glossed over above.
Suppose I gave you a triangle, and asked you to transform it into a square, or a circle. I will allow you ONLY simple topological transformations, such as translation, rotation, linear stretching/scaling, linear shear, but nothing more than that. None of the above transformations are sufficient to take an edge of a triangle and introduce a right angle bend into it, or eliminate such an essential singularity. So nothing you do will allow you to perfectly fit that triangular peg into a square or a round hole. NOTHING.
That is exactly what you are asking to do. The model you have posed has a fundamental shape to it. Actually, it represents an infinite family of fundamental shapes. NONE of those shapes are consistent with the curve you provide. The model parameters you are allowed to estimate will do simple things as I describe them. They will allow you to translate the entire curve, rotate it, scale it. But you are attempting to fit the wrong model for that data. It cannot be done, at least not with any rational measure of success.

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!