how can i give rand function as an input to the given difference equation?
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
s
le 1 Juil 2015
Réponse apportée : Star Strider
le 1 Juil 2015
n=10
x(n)=randn(n,1)
y(n)=2.5*x(n)+ x(n-1)
The x(n)should be given as input to the y(n) but when i tried doing that x(n) it is giving me the following error.
??? In an assignment A(I) = B, the number of elements in B and
I must be the same.
Error in ==> Untitled at 5
x(n)=randn(n,1).
But without using x(n) i cannot give the input to the y(n).
Kindly provide me a solution.
0 commentaires
Réponse acceptée
Star Strider
le 1 Juil 2015
You need a loop:
n = 10;
x = randn(n,1);
for k1 = 2:n
y(k1) = 2.5*x(k1) + x(k1-1);
end
figure(1)
plot(x, y, '-o')
grid
0 commentaires
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Fractals dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!