Filtering of data in simulink
조회 수: 15(최근 30일)
표시 이전 댓글
Andreas Volden 2014년 11월 24일
댓글: Andreas Volden 2014년 11월 26일
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
John Petersen 2014년 11월 26일
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.
댓글 수: 1
Find more on Signal Operations in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!Start Hunting!