how can I find y[n]

5 visualizaciones (últimos 30 días)
Bugrahan KISA
Bugrahan KISA el 6 de Mzo. de 2018
Comentada: Ship Chern Wei el 21 de Oct. de 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 comentario
KSSV
KSSV el 7 de Mzo. de 2018
What is your question? Tell about your problem with code given.

Iniciar sesión para comentar.

Respuesta aceptada

Abraham Boayue
Abraham Boayue el 7 de Mzo. de 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 comentarios
Bugrahan KISA
Bugrahan KISA el 8 de Mzo. de 2018
thank you for your answer .
Ship Chern Wei
Ship Chern Wei el 21 de Oct. de 2020
is there anyway to get the equation of y(n)

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Marine and Underwater Vehicles en Help Center y File Exchange.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by