How to Code This Using filter?
3 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Kareem Elgindy
le 18 Juil 2020
Réponse apportée : Devineni Aslesha
le 21 Juil 2020
I don't know how to use filter and unfortunately the Help Documentation of filter is not useful enough for me. I'd like to use filter to code the following recursive formula
x(i+1) = a(i)*x(i), i = 1, 2 , ..., n,
where a(i) is some function of i. Assume x(1) = 2. I don't want to use a for loop for possibly faster implementations.
0 commentaires
Réponse acceptée
Devineni Aslesha
le 21 Juil 2020
Assuming that 'a' is input data and 'x' is the output data, you can use the filter function as shown below
a = 1:5;
num = 1;
den = [1 -1];
x = filter(num,den,a)
for the linear filter equation x(i) - x(i-1) = a(i). However, in your case, it appears like the filter equation is a nonlinear equation. i.e. x(i+1)/x(i) = a(i). So, make sure if your filter equation is correct.
0 commentaires
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Digital Filter Analysis dans Help Center et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!