1.program For Discrete Time Sinusoidal Signal?: All All
1.program For Discrete Time Sinusoidal Signal?: All All
clc
clear all
close all
n=[-2 -1 0 1 2 3];
x=[2 4 5 3 -2 -1];
stem(n,x);
xlabel('no of samples');
ylabel('x(n) ------');
title('discete time signal');
function[u,n]=unitstep(n0,n1,n2)
n=n1:n2
u=[(n-n0)>=0]
end
clc
clear all
close all
n0=5;
n1=-20;
n2=30;
[u,n]=unitstep(n0,n1,n2)
stem(n,u);
xlabel(' n------->')
ylabel('u(n)----->')
title('unit step sequence')
clear all
close all
n1=input('enter the value of n1')
n2=input('enter the value of n2')
a=input('enter the value of a')
n=n1:n2
x=a.^n
stem(n,x)
xlabel('n-------->')
ylabel('a^n----->')
title('discrete time exponential sequence')
close all
n1=input('enter the value o n1:')
n2=input('enter the value of n2:')
n=n1:n2
x=3*cos((0.5*pi.*n)+(pi/3))+2*sin(0.3*pi.*n)
stem(n,x)
xlabel('n---->')
ylabel('x(n) ----->')
title('discrete time sinusiodal signal')
close all
n=[-2 -1 0 1 2 3];
x=[2 4 5 3 -2 -1];
subplot(2,2,1);
stem(n,x);
xlabel('no of samples');
ylabel('x(n) ------');
title('discete time signal');
n0=5;
n1=-20;
n2=20;
[del,n]=impseq(n0,n1,n2)
subplot(2,2,2);
stem(n,del);
xlabel('n ------>')
ylabel('del(n) ---->')
title('unit impulse signal')
n0=5;
n1=-20;
n2=30;
[u,n]=unitstep(n0,n1,n2)
subplot(2,2,3);
stem(n,u);
xlabel(' n------->')
ylabel('u(n)----->')
title('unit step sequence')