# How to Apply Statistical Algorithms of Signal Processing to Regulate Variation of a Curve?

Below I am posting 2 graphs. I want to regulate the curvature of first graph using some statistical methods such as use of standard deviations, and modulate my graph to look like second one.

I am not asking here for any matlab command, but for some statistical method or a signal processing algorithm I can implement using MATLAB.

I just want transformation of shape as that of image 2, I do not want to achieve exact values of image 2.

Thanks & Regards, Nick.

.

• Please make sure that the images/links work. – Tolga Birdal Jun 27 '17 at 14:05
• Welcome to SE.DSP! Please edit your question to add the graphs... otherwise your question doesn't make much sense. Closing until you edit. – Peter K. Jun 27 '17 at 14:55
• Oops...! the links were not working. They are now working now! Please answer if possible. Thanks for drwaing attention, @TolgaBirdal and Peter K. – Nick Jun 27 '17 at 15:57
• Are you asking for this specific case? If not, there are 3 variables: a.the input graph, b.the wanted transformation and c.the output graph, if you don't define accurately two of them I am afraid there will be no correct answer... – oxuf Jun 27 '17 at 20:06
• I just want transformation of shape as that of image 2, I do not want to achieve exact values of image 2.@oxuf – Nick Jun 28 '17 at 7:40

You can regulate its second derivative which is the curvature.

Something like:

$$\hat{x} = \arg \min_{x} \frac{1}{2} \left\| x - y \right\|_{2}^{2} + \frac{\lambda}{2} \left\| D D x \right\|_{2}^{2}$$

Where $y$ is samples you have and $D$ is the Derivative Operator (In Matrix Form). By applying it twice we're regulating the Second Derivative.
You can find a statistical explanation for this (Prior of Gaussian Distribution of the Second Derivative) or just call is Tikhonov Regularization.

This has a closed form solution:

$$\hat{x} = \left( I + \lambda {D}^{T} {D}^{T} D D \right)^{-1} y$$

You can use some fitting method. For example least - squares For example you can transform you image2 by the linear transformations - translation, stretching, scaling; to minimize the sum of squared deviations of the Y values of the transformed image2 from image1.

• Can you please elaborate this a bit more specifically with some examples? Also, please guide me how to implement them using MATLAB. – Nick Jun 28 '17 at 9:50
• Well, it is not a simple task. There are many ways to do it. The linear transformation for 2D shape can be not very simple subject, so I would first try to fit your second figure with polynomial (for example), then fit the linear transformation of obtained polynomial to the first figure. You can find some information and examples on curve fitting in matlab here: nonlinear-least-squares-curve-fitting [curvefit]mathworks.com/help/curvefit/curve-fitting.html) and so on... – Andrei Keino Jun 28 '17 at 11:58

Curvature of the signal is decided by the second and higher derivatives. It is possible to smoothen the curves using the idea of low-pass filter. Large curvature results from Fourier components having higher frequencies. There are two approaches of implementing a low pass filter.

1. After deciding the degree of smoothness, fix a low-pass filter response. Then using standard FIR (or IIR) filter design methods design the filter coefficients of required degree.

2. If the signal is finite duration one, you can use Fourier series least squares curve fitting upto a certain order. This would constraint the curvature of your signal to the required smoothness. The smoothened signal will have the form : $$f(t) = \sum_{k=-L}^{L} a[k] e^{j 2 \pi kt},$$ assuming the signal support as $T =1$sec.

MATLAB allows you to perform Fourier series fitting upto a degree of 8. -- see curve fitting toolbox.