Documente Academic
Documente Profesional
Documente Cultură
i=a^2 i= 7 10 % exponential
15 22
j=a.^2 j= 1 4 % element by
9 16 element
exponention
k=det(a) k= -2 % determint
n=a' n= 1 3 % transpose
2 4
q=[a a; b b] q= 1 2 1 2 % concatenation
3 4 3 4
5 6 5 6
7 8 7 8
a(:,2)=[] a= 1 % deleting the
3 second column
t=-n:n; t = -5 -4 -3 -2 -1
0 1 2 3 4 5
ximpulse=[zeros(1,n) ones(1,1)
zeros(1,n)];
subplot(5,2,1)
plot(t,ximpulse); xlabel('Time');
ylabel('Amplitude'); title('Impulse
function');
subplot(5,2,2)
stem(t,ximpulse); xlabel('Time');
ylabel('Amplitude'); title('Impulse
sequence');
tunitstep=0:n;
xstep=ones(1,n+1);
subplot(5,2,3)
plot(tunitstep,xstep);
xlabel('Time'); ylabel('Amplitude');
title('Unitstep function');
subplot(5,2,4)
stem(tunitstep,xstep);
xlabel('Time'); ylabel('Amplitude');
title('Unitstep sequence');
tramp=0:n;
subplot(5,2,5)
plot(tramp,tramp); xlabel('Time');
ylabel('Amplitude'); title('Ramp
function');
subplot(5,2,6)
stem(tramp,tramp); xlabel('Time');
ylabel('Amplitude'); title('Ramp
sequence');
texp=0:.1:n;
xexp=10*exp(texp);subplot(5,2,7)
plot(texp,xexp); xlabel('Time');
ylabel('Amplitude');
title('Exponential function');
subplot(5,2,8)
stem(texp,xexp); xlabel('Time');
ylabel('Amplitude');
title('Exponential sequence');
tsine=0:0.1:n;
xsine=sin(tsine);
subplot(5,2,9)
plot(tsine,xsine); xlabel('Time');
ylabel('Amplitude'); title('Sine
function');
subplot(5,2,10)
stem(tsine,xsine); xlabel('Time');
ylabel('Amplitude'); title('Sine
sequence');
tsaw=0:0.001:.1;
xsaw=sawtooth(2*pi*100*tsaw,0.5);
subplot(5,2,3)
plot(tsaw,xsaw); xlabel('Time');
ylabel('Amplitude');
title('Sawtooth function');
subplot(5,2,4)
stem(tsaw,xsaw); xlabel('Time');
ylabel('Amplitude'); title('Sawtooth
sequence');
tsquare=0:0.001:.1;
xsquare=square(2*pi*100*tsquare,50);
subplot(5,2,5)
plot(tsquare,xsquare);
xlabel('Time'); ylabel('Amplitude');
title('Square function');
subplot(5,2,6)
stem(tsquare,xsquare);
xlabel('Time'); ylabel('Amplitude');
title('Square sequence');
xran=rand(1,100);
subplot(5,2,7)
plot(0:99,xran); xlabel('Time');
ylabel('Amplitude'); title('random
noise function');
subplot(5,2,8)
stem(0:99,xran); xlabel('Time');
ylabel('Amplitude'); title('random
noise sequence');
X2=[x2 zeros(1,N-N2)];
for m=1:N
y(m) = 0;
for n=1:N
i=m-n+1;
if(i<=0)
i=N+i;
end
y(m) = y(m)+X1(n)*X2(i);
end
end
disp('The linear convolution of two % Displays the
given sequences is:'); result on command
disp(y); window
subplot(3,1,1)
stem(1:N1, x1); xlabel('Time');
ylabel('x(n)'); title('input
sequence x(n)');
subplot(3,1,2)
stem(1:N2, x2); xlabel('Time');
ylabel('h(n)');
title('input sequence h(n)'
subplot(3,1,3)
stem(n, y);
xlabel('Time'); ylabel('linear
convolution output');
title('linear convolution');