how can I find y[n]

5 vues (au cours des 30 derniers jours)
Bugrahan KISA
Bugrahan KISA le 6 Mar 2018
Commenté : Ship Chern Wei le 21 Oct 2020
I want to find output of system y[n] for n = 1,2,3,4 , y[n] is equal to y[n]=0.5*y[n-1] + x[n] + 0.5*x[n-3] .I have a knowledge about this system , system is LTI .I don't know right the code that below.
n = [1:4];
x = cos(pi.*n).*[0 ones(1,3)];
x_shifted=[0 x(1:end-1)];
x_scaled=2.*x;
% stem(n,x)
y(3) = 0;
y2(3) = 0;
for k=4:length(x)
y(k) = 0.5*y(k-1) + x_shifted(k) +0.5*x_shifted(k-1)+0.5*x_shifted(k-3);
y2(k)=0.5*y(k-1) + x(k) + 0.5*x(k-3);
end
stem(n,y,'rx')
hold on
stem(n,y2,'b')
  1 commentaire
KSSV
KSSV le 7 Mar 2018
What is your question? Tell about your problem with code given.

Connectez-vous pour commenter.

Réponse acceptée

Abraham Boayue
Abraham Boayue le 7 Mar 2018
% write your equation as : y(n)-0.5y(n-1) = x(n)+0x(n-1)+0x(n-2)+0.5x(n-3)
% and define the coefficient vectors a and b as shown.
n = 1:4;
a = [1 -0.5];
b = [1 0 0 0.5];
x = cos(pi.*n).*[0 ones(1,3)];
y = filter(b,a,x); % output of the LTI system
stem(n,y,'linewidth',3,'color','m')
grid;
a = title('Output of an LTI System y(n)');
set(a,'fontsize',14);
a = ylabel('y(n)');
set(a,'Fontsize',14);
a = xlabel('n [1 4]');
set(a,'Fontsize',14);
% figure
% stem(n,x,'linewidth',3,'color','g')
  3 commentaires
Bugrahan KISA
Bugrahan KISA le 8 Mar 2018
thank you for your answer .
Ship Chern Wei
Ship Chern Wei le 21 Oct 2020
is there anyway to get the equation of y(n)

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Marine and Underwater Vehicles 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!

Translated by