Filtering of data in simulink
11 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Hi! I have a matlab script which solves an LSE problem of the standard form: z = theta'*phi.
Since the equation have a derivative, I filter it using a first order filter. I've implemented the filters in Simulink, and the script calls this model to obtain filtered variables. Filters has to be identical.
The model uses variables from the script and is supposed to return the filtered variables. Time vector for this simulation is t=[1:3597]; The samples in delta_q_t and p_c_t are the same size(1:3597).
Problem is that my returned values don't match desired output(1x3597), they depend on the second denominator value(which is 5 is this pic). In the script i use the command: sim('model name',[1 n]); where n=3597.
Anyone who can help me? Another possibility is to add the filters straight into the script, but I'm not sure how to do this. Any help would be appreciated!
2 Kommentare
John Petersen
am 24 Nov. 2014
what is your sample time? if t=[1:3597] that looks like 1s sampling. Maybe that's too slow for you system.
Antworten (1)
John Petersen
am 26 Nov. 2014
A simple low pass filter (for scalar inputs - easily modified for vectors) is
y(i) = (alpha)* y(i-1) + (1-alpha)*x(i);
where alpha is between 0-1 depending on how much you want to filter. e.g. alpha = 0.99 is heavily filtered. If using an M-function block then you need to persist y or add a unit delay of y as another input. You could also do this with simulink blocks and not use a matlab function.
Siehe auch
Kategorien
Mehr zu Array and Matrix Mathematics finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!