Fitting a simple digital signal from noisy measurements (piecewise linear fitting?)

2 visualizaciones (últimos 30 días)
I have a digital signal from scope measurements:
Note that the transitions seem to be mainly due to slewing (=charging load capacitance with a constant current) as opposed to bandwidth limitation (linear system, RC, ...).
This suggests this signal can be well described by a piecewise linear function.
What is the easiest way to do this in MATLAB?

Respuestas (1)

Star Strider
Star Strider el 8 de Oct. de 2021
I cannot find a built-in function that incorporates a slew rate, so so programming it yourself would be necessary.
One option could be:
sqs = @(t) (10*t).*(t>=0 & t<0.1) + 1.*(t>=0.1 & t<0.2) + (3-10*t).*(t>=0.2 & t <0.3);
t = linspace(0, 1);
figure
hold on
for n = 0:0.5:2;
plot(t+n, sqs(t), '-b')
end
hold off
grid
Adjust the slew rate, signal segment durations, and amplitudes to get the desired result.
I leave the rest to you.
.
  2 comentarios
Daniel H
Daniel H el 8 de Oct. de 2021
Thank you, that’s a great start.
But my question was also about the fitting itself,m from the measurement data. For example, such that the quadratic error between the measurements and your function is minimized
Star Strider
Star Strider el 8 de Oct. de 2021
My pleasure!
The function I provided should be a prototype for that (set certain constants to instead be parameters, and use that as the objective function), unless a model of the circuit that produced that plot is available, and if so, just fit those parameters. The fitting process would be the same. The Optimization, Global Optimization, and Statistics and Machine Learning Toolboxes have nonlinear parameter estimation routines that should works with that, although the Global Optimization Toolbox functions could be more robust.
Another option would be to use the System Identification Toolbox functions to fit it. (Remember to use the compare function to get a visual representation of how good the fit is.)
.

Iniciar sesión para comentar.

Categorías

Más información sobre Get Started with Curve Fitting Toolbox en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by