summaryrefslogtreecommitdiff
path: root/1592/CH10/EX10.8/example_10_8.sce
blob: bc7464bb94df8cb249072c29106e29511e230cce (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
//Scilab Code for Example 10.8 of Signals and systems by
//P.Ramakrishna Rao
//Auto Correlation
clear;
clc;
function [y]=u(t)
    if t>=0
    y=1
else y=0
    end
endfunction
k=1;
a=0.8;
for n=-30:30;
    x(k)=a^(n)*u(n);
    k=k+1;
end
length(x)
//computation of auto correlation sequence;
r = xcorr(x);
n=-60:60;
a=gca();
a.x_location="origin";
a.y_location="origin";
plot2d3(n,r,-4);
title('rxx_auto-correlation');