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.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/166477/image.png)
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.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/166478/image.png)
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
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.
回答(1 个)
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.
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!