Fitting a simple digital signal from noisy measurements (piecewise linear fitting?)
2 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
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?
0 Commenti
Risposte (1)
Star Strider
il 8 Ott 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 Commenti
Star Strider
il 8 Ott 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.)
.
Vedere anche
Categorie
Scopri di più su Linear and Nonlinear Regression in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!