summaryrefslogtreecommitdiff
path: root/2303/CH10/EX10.2/10_2.sce
blob: a74e08cfbbd250eb75fa18c4bef5996540113b29 (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
29
30
31
//Example 10.2

clc;
close;
clear;
fx=16000;    //sampling frequency of original signal

//Plotting original sequence
for f=1:1024
    original(f)=sin(2*180*f/(fx/2));    
end
subplot(2,1,1);
plot2d3(original);
title('Original sequence');
xlabel('Frequency');
ylabel('Amplitude');

intf=2;       //interpolation factor
interpolated=[];

//Interpolation
for i=0:length(original)-1                
    interpolated(intf*i+1,1)=original(i+1);
end

//Plotting interpolated sequence
subplot(2,1,2);
plot2d3(interpolated);
title('Interpolated sequence');
xlabel('Frequency');
ylabel('Amplitude');