Why my polynomial function is wavy

4 visualizaciones (últimos 30 días)
Jeanne Dury
Jeanne Dury el 29 de Nov. de 2022
Comentada: John D'Errico el 29 de Nov. de 2022
I work on biomechanical analysis of a jump landing. I use force plate and I would like to calculate the time to stabilisation. The calculation methods consist of fitting ground reaction force with an unbounded third-order polynomial. For that I used a polyfit and polyval functions (script below). Nevertheless, my fitting appears wavy (figure below) and doesn't match with examples in litterature...
Is it the good function for this application? Can I adjust this function to avoid wave?
Thanks you very much for your help!
x=0:0.0005:((length(STPRE1_vTTS_abs)-1)/2000);
x=x';
p=polyfit(x,STPRE1_vTTS_abs,3); %3rd order
v=polyval(p,x)
figure
plot(x,STPRE1_vTTS_abs,x,v)
yline(STPRE1_seuil_vTTS)
  1 comentario
Matt J
Matt J el 29 de Nov. de 2022
All 3rd order polynomials are wavy. Not sure what you expect.

Iniciar sesión para comentar.

Respuesta aceptada

John D'Errico
John D'Errico el 29 de Nov. de 2022
Editada: John D'Errico el 29 de Nov. de 2022
A simple rule applies: Polynomials oscillate. Not infinitely many times. But this is a fundamental nature of polynomials. As they grow in order, they will exhibit more bumps in them. But a cubic polynomial will always have a simple fundamental shape, of a transition from a zone of negative curvature to a zone of positive curvature. And that in turn forces the curve to have the shape you see. For example, we see this:
fplot(@(x) x.^3,[-3,3])
yline(0)
xline(0)
Do you see the cubic has positive curvature above x==0, and negative curvature below that point? This is the simplest possible cubic polynomial of course, because it has a triple root at x==0. But any cubic polynomial will have that same fundamental shape (though possibly flipped upside down.)
Consider a little more extreme polynomial. If the roots are separated, then we have a curve with more shape.
fplot(@(x) (1-x).*x.*(2+x),[-3,3])
yline(0)
Again the same fundamental shape. I flipped it upside down this time. But you need to understand that because a cubic polynomial will ALWAYS approach +/- infinity at each end of the real line, and becaue it provably will go in the opposite directions as you go to infinity either way, the curve has a very limited set of behaviors it will encompass.
Cubic polynomials just look exactly that way. It is in their genes, and they can do nothing to change that fact.
Higher order polynomials are much the same, but they generally have more bumps and wiggles in them, not less.
A simple extension of the above, is that polynomials can NEVER be used to approximate curves that transition from some curved state to one where the curve is just constant. This is cetainly true where the function is expected to approach a constant function as a limit. And your data appears to do EXACTLY that.
So why is your curve wavy? It is wavy because you used a model for a function that is intrinsicly curvy. As I said, waviness is in its genes. If you don't like waves, then don't use a polynomial.
Does that answer your question? I think it does not answer your problem, though it does answer the basic question posed.
Perhaps the better question is if there is a better way to model your curve, that will allow you to predict a time to stabilization. That would be easy in a sense, but you need to decide what defines stabilization. Thus, I see some amount of oscillations in the curve no matter how far out you go.
  2 comentarios
Jeanne Dury
Jeanne Dury el 29 de Nov. de 2022
Thanks you for your answer and your explanations. This allows me to better understand these oscillations. The literature tells us to use a 3rd order polynomial function, so I followed these recommendations. But in litterature their fitting was not as wavy as my fitting that's why I thought I made a mistake in using the polynomial function. I will check with the authors if they really used this way to model the curve.
Many thanks.
John D'Errico
John D'Errico el 29 de Nov. de 2022
They may have simply been lucky, in that the curve they fit had its wavy behavior outside the region of support of the data. That just says they used a poor choice of model, but got lucky. You were not so lucky.
I'll say it differently. Trying to use a cubic polynomial to model asymptotic behavior is a flat out bad idea, one that if I were a referee on their paper, I would have shot down. Seriously. There are better ways to estimate the asymptotic behavior, and to decide when the curve has finally stabilized from the initial transient.
For example, they MIGHT have used the data in the latter part of the curve to estimate the asymptotic mean and the noise around that long term mean. Now just look at the earlier data, to then decide where the curve is deviating from the long term mean by more than some multiple of the long term standard deviation. This would be a simple scheme that would work reasonably, and not require that you fit some model to the data that is completely inappropriate for that relationship.

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Biological and Health Sciences en Help Center y File Exchange.

Productos


Versión

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by