Doubts about using regression (Matlab)
显示 更早的评论
I have a data set (Col_A and Col_B) and I need to find the value of Col_B when Col_A is 0.
Col_A Col_B
983 235.2
960 237.1
945 225.9
I've tried several commands, such as fit, fitlm, polyfit, regress but the results are not as expected.
When I use Excel to find the Trendline and find the value if I create the "Insert Scatter (X, Y) or Bubble Chart" graph, I find the values close to what I find in Matlab (which does not correspond with what search) when I create the graph using the "Insert Line or Area Chart" the value found by the trend line is within the expected.
However, I cannot find this value through Matlab.

Codes I've used
fit(Col_A,Col_B,'poly2')
fitlm(Col_A,Col_B,'poly2')
regress(Col_A,Col_B)
polyfit(Col_A,Col_B,2)
polyfit(Col_A,Col_B)
8 个评论
Rik
2021-1-11
Your data is very far from what you're looking for. Any trend line you will fit to only 3 points will be close to meaningless if you don't know the underlying function and only need to fit the parameters.
Can you confirm you want to fit a second order polynomial?
Juliano Cardoso
2021-1-11
Rik
2021-1-11
Your data range is 945-983. How will you prevent garbage outcomes if you try to extrapolate to 0? You can indeed use a polynomial, but you need to make sure you know enough about the system you're modeling to decide if that makes sense. You could also fit a sine wave to your data.
So again: are you very sure you need a second order polynomial specifically?
Juliano Cardoso
2021-1-11
Cris LaPierre
2021-1-11
Perhaps you are over complicating it. If a linear model would work as well as a 2nd order polynomial for your needs (which would result in very different values), what about just hard coding a generic value?
Juliano Cardoso
2021-1-11
Rik
2021-1-11
If you want a different value every time you could also consider using the mean of your data.
Juliano Cardoso
2021-1-11
回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Polynomials 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!