summaryrefslogtreecommitdiff
path: root/692/CH2/EX2.1/P2_1.sce
blob: b174a12370acebabc2f151176276633e62428509 (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
27
28
//EXAMPLE 2.1
//Ensemble averaging
clear ;
clc ;
n = 1:50;
clf();
figure(0)
a=gca();
a.x_location="origin";
a.y_location="origin";
   for i =1:length(n)
       s(i)=2*n(i)*((0.9)^n(i));
       d(i)=(-0.1)^n(i);       //arbitrary noise signal.
   end

M=length(n);
 
 for i =1:M
     d(i)=(-0.1)^i;
     S=sum(d);
 end
Eav=(s+S/M)';          //Ensemble average.
disp(Eav,'The output of Ensemble averaging is')
plot2d3(n,s)
plot(n,s,'r.')
xtitle('Ensemble averaging','n','Eav-s');
a.children.children.thickness=2;
a.children.children.foreground=2;