MATLAB Answers

Problem In curve fitting

5 views (last 30 days)
Hello, I need to find a function for my data (TW2 and DatiOpt.PERDITE_FERRO) with minimum error. I tried "scatteredInterpolant" without any success. would you please help me to find the best fit for these sort of data? I appreciate your help.
load('TwMap_250Nm_cross saturation.mat');
xlabel('Torque*Speed^2 [M Nm*(r/min)^2]', 'FontSize', 16);
ylabel('Iron Losses [W]', 'FontSize', 16);
grid on;
title('IPM: Motor Iron Losses', 'FontSize', 16);
f = scatteredInterpolant(TW2,DatiOpt.PERDITE_FERRO);


KSSV on 19 Jun 2018
What you want to fit?
Solmaz Kahourzade
Solmaz Kahourzade on 20 Jun 2018
Dear KSSV, If you plot figure 1, you see that there is a general trend between the TW2 and DatiOpt.PERDITE_FERRO. I wanted to find the nearest Polynomial function between TW2 and DatiOpt.PERDITE_FERRO that I can use for other inputs. However, base on John's answer, as my data are arbitrary, I can not find any function.
I appreciate if you have any solution.
Best Regards,

Sign in to comment.

Accepted Answer

John D'Errico
John D'Errico on 19 Jun 2018
You won't find a function that fits any arbitrary, essentially scattered set of data. And that is what you seem to have.
Anyway, you do not seem to understand how to use scatteredInterpolant. Read the help.
F = scatteredInterpolant(X,v) creates an interpolant that fits a
surface of the form v = F(X) to the sample data set (X,v). The sample
points X must have size NPTS-by-2 in 2-D or NPTS-by-3 in 3-D, where
NPTS is the number of points. Each row of X contains the coordinates of
one sample point. The values v must be a column vector of length NPTS.
This is how you called scatteredInterpolant:
f = scatteredInterpolant(TW2,DatiOpt.PERDITE_FERRO);
However, TW2 is a 121x126 array, that is itself a function of two other variables.
So it is not at all clear what interpolation you are trying to achieve, what model you might want to see here.


Solmaz Kahourzade
Solmaz Kahourzade on 20 Jun 2018
Dear John,
Thank you for your reply. I will seek other approaches now as I can not a function that fits any arbitrary data.
Any way, I wanted to find the nearest Polynomial function between TW2 and DatiOpt.PERDITE_FERRO as they follow a Polynomial function.
John D'Errico
John D'Errico on 20 Jun 2018
The relationship that you want to be a "polynomial"
Does not seem to be even close to a polynomial.
There is too much else happening in that relationship, due to other, ancillary variables that belies your claim. In fact, it is arguably rarely true that any relationship from the real world is truly a polynomial one, and even more rarely true when that relationship is pushed to its limits. Yes, I know of cases where a one can indeed show that a relationship should be, and in fact can be shown to be a true polynomial one. But most of the time, one must merely accept that a polynomial model provides a decent approximation.
In some cases, a polynomial can indeed be be a good approximation. But here? The "noise" in this relationship is really lack of fit, not noise, and that noise is clearly almost as important as the relationship between those two variables.
So, if you want a model for this process, then you need to return to the system that created it. Spend time deriving a model from first principles, one that is based on the theory of the process. But there is just way too much happening in this to claim a direct polynomial relationship.
Solmaz Kahourzade
Solmaz Kahourzade on 20 Jun 2018
Dear John,
Thank you. You are right. I will resolve it from the initial model.

Sign in to comment.

More Answers (0)

Sign in to answer this question.

Translated by