lsqnonlin with tanh solutions

2 次查看(过去 30 天)
Hi guys,
I have been banging my head over why the lsqnonlin function just wouldnt fit a parametrization of the type:
fun=(@c) c(1) * tanh ((x-c(2))/c(3))
to a standard PPG(Pulse Plethysmography) wave form.
The idea is that I want the parameters c(1) - amplitude; c(2) - phase shift and c(3) - steepness of the tanh, so I can characterize the beginning of the blood pressure pulse form PPG.
Here, the blue curve represents a tanh function with c=[10e8,15,12] and the orange curve is one blood pulse wave. I want the blue curve to shift in c until a least square solution (global max) is found, but the function always terminates in a local minimum with exit flag - 3 - Change in the residual was less than the specified tolerance.
In the future I also want to add a Hanning window to the tanh function so it looks even more to the blood pressure pulse, but for now I want to focus on this.
I hope the information I provided was enough for an answer, I will be glad to help you to help me. :)
  2 个评论
John D'Errico
John D'Errico 2017-8-2
You want to shift the blue curve until it fits the orange curve? It ain't never gonna fit. No matter how hard you try, stuffing a square peg into a round hole tends to be a difficult task, and you won't be happy with the result.
Are you trying to approximate only one part of the curve? If so, then using the entire curve simply won't work.
So you need to explain your problem more carefully, at least if you actually want a useful answer.
Martin Elenkov
Martin Elenkov 2017-8-3
Hi John,
I am searching for a least squares solution, that doesn't mean that the sum of squared difference should be zero (perfect fit), but I want to find its global minimum - best fit. At the same time, you are right. I am interested only in the anacrotic phase (the ascending part of the curve before the peak). Thanks for the question! I am new to posting and I find it hard to explains myself clearly.

请先登录,再进行评论。

回答(1 个)

Star Strider
Star Strider 2017-8-2
The hyperbolic tangent may not be appropriate for a PPG signal.
However, if you want to use it, a more reasonable function would be one that shifts and scales:
fun=(@c) c(1) + tanh (x-c(2)) * c(3);
Here, ‘c(1)’ sets the lower limit, ‘c(2)’ shifts it, and ‘c(3)’ scales it.
  1 个评论
Martin Elenkov
Martin Elenkov 2017-8-3
编辑:Martin Elenkov 2017-8-3
Hi Star Strider,
thank you for your response! Actually, the idea is not an original idea of mine. I read in a paper that the tanh parametrization in the form I gave gives the most accurate results and is the most robust to noise. Still I will give your suggestion a try, although this approach is missing slope adjustment.

请先登录,再进行评论。

Community Treasure Hunt

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

Start Hunting!

Translated by