how can I find y[n]

7 visualizzazioni (ultimi 30 giorni)
Bugrahan KISA
Bugrahan KISA il 6 Mar 2018
Commentato: Ship Chern Wei il 21 Ott 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 Commento
KSSV
KSSV il 7 Mar 2018
What is your question? Tell about your problem with code given.

Accedi per commentare.

Risposta accettata

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

Accedi per commentare.

Più risposte (0)

Categorie

Scopri di più su Marine and Underwater Vehicles in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by