2. Chapter4. Sampling of Continuous-Time Signals
1. A/D Conversion and Sampling
2. Reconstruction of a Bandlimited Signals
3. Continuous-Discrete Frequency Characteristics
4. Digital Processing of Continuous-Time Signals
5. Changing the Sampling Rate Using Discrete-Time Processing
6. Multi rate Signal Processing
7. Practical Considerations in A/D and D/A Conversions
8. Multirate Processing for A/D and D/A Conversions
3. Signal Types
3
Analog signals: continuous in time and amplitude
Example: voltage, current, temperature,…
Digital signals: discrete both in time and amplitude
Example: attendance of this class, digitizes analog signals,…
Discrete-time signal: discrete in time, continuous in amplitude
Example: hourly change of temperature in Austin
Theory is based on discrete-time continuous-amplitude signals
Most convenient to develop theory
Good enough approximation to practice with some care
4. Why digital?
4
Digital techniques need to distinguish between discrete symbols
allowing regeneration versus amplification
Good processing techniques are available for digital signals, such as
medium.
Data compression (or source coding)
Error Correction (or channel coding)
Equalization
Security
Easy to mix signals and data using digital techniques (Time Division
Multiplexing)
7. Sampling
• The signals we use in the real world, such as our voices, are
called "analog" signals.
• To process these signals in computers, we need to convert the
signals to "digital" form.
• Analog signal is continuous in both time and amplitude, a
digital signal is discrete in both time and amplitude.
8. Sampling(.)
• To convert a signal from continuous time to discrete time, a process
called sampling is used. The value of the signal is measured at certain
intervals in time.
• Each measurement is referred to as a sample. (The analog signal is
also quantized in amplitude, but that process is ignored as it will be
explained by some other group)
9. Figure 0: Signal sampling representation.
The continuous signal is a green colored line
Discrete samples are indicated by the blue vertical lines.
10. Analog to Digital Conversion
10
Analog-to-digital conversion is (basically) a 2 step process:
Sampling
• Convert from continuous-time analog signal xa(t) to discrete-time
continuous value signal x(n).
• Is obtained by taking the “samples” of xa(t) at discrete-time
intervals, Ts
Quantization
• Convert from discrete-time continuous valued signal to discrete
time discrete valued signal
11. Definition
11
Bit Rate
Actual rate at which information is transmitted per second
are transmitted,
Baud Rate
Refers to the rate at which the signaling elements
i.e. number of signaling elements per second.
Bit Error Rate
The probability that one of the bits is in error or simply the
probability of error
12. Sampling
12
Sampling is the processes of converting continuous-time analog signal,
xa(t), into a discrete-time signal by taking the “samples” at discrete-time
intervals
Sampling analog signals makes them discrete in time but still continuous valued.
If done properly (Nyquist theorem is satisfied), sampling does not introduce
distortion
Sampled values:
The value of the function at the sampling points
Sampling interval:
The time that separates sampling points (interval b/w samples), Ts
If the signal is slowly varying, then fewer samples per second will be required than
if the waveform is rapidly varying
So, the optimum sampling rate depends on the maximum frequency component
present in the signal
13. Sampling(..)
• A sample is a value or set of values at a point in time and/or space.
• A sampler is a subsystem or operation that extracts samples from a
continuous signal.
• A theoretical ideal sampler produces samples equivalent to the
instantaneous value of the continuous signal at the desired points.
14. First step toward Digital Signal Processing
Main question:
Can a finite number of samples of a continuous wave be enough to
represent the information?
OR
Can you tell what the original signal was below?
14
16. Sampling
16
• If one period of Sine wave spans takes 32 ms to complete then, t=32ms
• Given Time Period=125μs
• Number of Samples=?
• N= 32ms/125μs= 256 samples
17. How sampling is done?
• First obtain signal values from the continuous signal at regular time-
intervals (Ts). Which is sampling time and its reciprocal is fs sampling
frequency
• The result of this process is just a sequence of numbers.
• Our discrete time signal will be denoted as x[n] where n is index.
• As sampling interval Ts is defined, sampling just extracts the signals
value at all integer multiples of Ts such that
x[n] = x(n·Ts)
18. How sampling is done?(.)
• At this point (after sampling), our signal is not yet completely digital
because the values x[n] can still take on any number from a
continuous range.
• So we use the terms discrete-time signal.
• Figure 1 illustrates the process of sampling a continuous sinusoidal.
19. How sampling is done?(..)
• For Input signal
• Known as discrete time frequency, Normalized continuous frequency.
20. Example: Sampling rate Comparisons
• Consider at sampling rates of 240 and 1000 samples per second
23. Key Elements of Sampling and Reconstruction
Sampling
continuous-time
signal
t
analog sampling
analog-digital
conversion
DSP Operations
t n
DSP Operations
digital-analog
conversion
reconstruction
continuous-time
signal
23
• A continuous-time signal is sampled at discrete time intervals and subsequently
converted to a sequence of digital values for processing.
Reconstruction
n t t
• The sequence of digital values is converted into a series of impulses at discrete
time intervals before being reconstructed into a continuous-time signal.
• Sampling and Reconstruction are mathematical duals.
24. Ambiguity of Sampled-Data Signals
2
4
• Which continuous-time signal does this discrete-time sequence represent?
• Knowing the sampling rate, is not enough to uniquely
reconstruct a continuous-time signal from a discrete-time
sequence.
• The uncertainty is a result of aliasing.
25. Ideal Sampling
25
Sampling Rate (or sampling frequency fs):
The rate at which the signal is sampled, expressed as the number of samples
per second (reciprocal of the sampling interval), 1/Ts = fs
Nyquist Sampling Theorem (or Nyquist Criterion):
If the sampling is performed at a proper rate, no info is lost about the
original signal and it can be properly reconstructed later on
Statement:
“If a signal is sampled at a rate at least, but not exactly equal to twice
the max frequency component of the waveform, then the waveform can
be exactly reconstructed from the samples without any distortion”
fs 2fmax
26. Ideal Sampling
26
In case the signal fails to fulfill the Nyquist criterion, there are two main
scenarios that can occur
1. Over Sampling
2. Under Sampling
27. Under Sampling
• In Undersampling a band pass signal is sampled slower than
its Nyquist rate.
• When one undersamples a bandpass signal, the samples are
indistinguishable from the samples of a low-frequency samples of the
high-frequency signal.
• In such a way that the lowest-frequency alias satisfies the Nyquist
criterion, because the bandpass signal is still uniquely represented
and recoverable. Such undersampling is also known as bandpass
sampling, harmonic sampling, IF sampling, and direct IF to digital
conversion.
28. Oversampling
• In Oversampling a signal is sampled faster than its Nyquist rate.
• Oversampling is used in most modern analog-to-digital converters to
reduce the distortion or noise effects introduced by practical digital-
to-analog converters.
32. 4.1 Periodic Sampling
In this method x[n] obtained
from xc(t) according to the
relation :
32
[ ] ( )
1/
c
s
x n x nT n
T sampling period f T sampling frequency
• The sampling operation is generally not invertible i.e.,
given the output x[n] it is not possible in general to
reconstruct xc(t). Although we remove this ambiguity by
restricting xc(t).
Chapter 4: Sampling of Continuous-Time Signals
33. BGL/SNU
Ideal C/D Conversion
Ideal D/C conversion
s(t)-impulse train
o T 2T 0 1 2.......
xc(t) xs(t) x(n)
Impluse train to
discrete
sequence
Conversion
X
Ideal
Reconstruction
Filter
Disc.Seq.to
Imp.Tr.
Conversion
0 1 2
T 2T...
ys(n)
Hr(j)
y(n) yr(n)
34. Sampling with a Periodic Impulse Train
Figure(a) is not a representation
of any physical circuits, but it is
convenient for gaining insight in
both the time and frequency
domain.
34
( ) ( )
n
s t t nT
(a) Overall system
(b) xs(t) for two sampling rates
(c) Output for two sampling
rates
35. 35
t
x
0
x
T
x
T
x 2
t
x
t
xp
nT
t
t
p
n
-3T -2T -T 0 T 2T 3T 4T t
40. 4.2 Frequency Domain Representation of Sampling
Let us now consider the Fourier transform of xs(t):
40
( ) ( ) ( ) ( ) ( ) ( )
( ) ( ) ( ) ( )
s c c
n
s c
n
x t x t s t x t t nT Modulation
x t x nT t nT Shifting property
( ) ( )
Fourier
s t S j
( ) ( )
Fourier
c C
x t X j
radians/s.
in
rate
sampling
the
is
/
2
where
)
(
2
)
( T
k
T
j
S s
k
s
1 1
( ) ( )* ( ) ( )
2
s c c s
k
X j X j S j X j k
T
Chapter 4: Sampling of Continuous-Time Signals
41. Frequency Domain Representation of Sampling
By applying the continuous-time Fourier transform to
equation
We obtain
consequently
41
2
1
)
(
T
k
T
j
X
T
e
X
k
c
j
( ) ( ) ( )
j j T
s T
X j X e X e
( ) ( ) ( )
s c
n
x t x nT t nT
( ) ( ) j Tn
S c
n
X j x nT e
[ ] ( ) ( ) [ ]
j j n
c
n
x n x nT and X e x n e
Chapter 4: Sampling of Continuous-Time Signals
42. Exact Recovery of Continuous-Time from Its Samples
(a) represents a band
limited Fourier transform
of xc(t) Whose highest
nonzero frequency is
.
(b) represents a periodic
impulse train with
frequency.
(c) shows the output of
impulse modulator in the
case
42
N
S
2
S N N S N
Chapter 4: Sampling of Continuous-Time Signals
43. Exact Recovery of Continuous-Time from Its Samples
In this case
don’t overlap
therefore xc(t) can be
recovered from xs(t) with
an ideal low pass filter
with gain T and cutoff
frequency
It means
43
=
( )
C
X j
( )
r
H j
N C S N
( ) ( )
r C
X j X j
Chapter 4: Sampling of Continuous-Time Signals
44. Aliasing Distortion
(a) represents a band
limited Fourier transform
of xc(t) Whose highest
nonzero frequency is
.
(b) represents a periodic
impulse train with
frequency.
(c) shows the output of
impulse modulator in the
case
44
N
S
2
S N N S N
Chapter 4: Sampling of Continuous-Time Signals
45. Aliasing Distortion
In this case the copies of overlap and is not longer
recoverable by lowpass filtering therefore the reconstructed
signal is related to original continuous-time signal through a
distortion referred to as aliasing distortion.
45
( )
C
X j
Chapter 4: Sampling of Continuous-Time Signals
46. Aliasing Understanding through MATLAB
f = 60; % Hz
tmin = -0.05;
tmax = 0.05;
t = linspace(tmin, tmax, 400);
x_c = cos(2*pi*f * t);
plot(t,x_c)
xlabel('t (seconds)'
46
Chapter 4: Sampling of Continuous-Time Signals
Continuous-time cosine signal at 60 Hz.
linspace(X1, X2) generates a row vector of 100
linearly equally spaced points between X1 and X2.
47. Aliasing Understanding through MATLAB
T = 1/800;
nmin = ceil(tmin / T);
nmax = floor(tmax / T);
n = nmin:nmax;
x1 = cos(2*pi*f * n*T);
hold on
plot(n*T,x1,'.')
hold off
47
Chapter 4: Sampling of Continuous-Time Signals
Sample with a sampling frequency of 800 Hz.
The sampling frequency of 800 Hz is well
above 120 Hz, which is twice the
frequency of the cosine. And you can see
that the samples are clearly capturing
the oscillation of the continuous-time
cosine.
48. Aliasing Understanding through MATLAB
T = 1/400;
nmin = ceil(tmin / T);
nmax = floor(tmax / T);
n = nmin:nmax;
x1 = cos(2*pi*f * n*T);
plot(t, x_c)
hold on
plot(n*T, x1, '.')
hold off
48
Chapter 4: Sampling of Continuous-Time Signals
Sample with a sampling frequency of 400 Hz.
The samples above are still adequately
capturing the shape of the cosine.
49. Aliasing Understanding through MATLAB
T = 1/120;
nmin = ceil(tmin / T);
nmax = floor(tmax / T);
n = nmin:nmax;
x1 = cos(2*pi*f * n*T);
plot(t, x_c)
hold on
plot(n*T, x1, 'o')
hold off
49
Chapter 4: Sampling of Continuous-Time Signals
Drop the sampling frequency down to exactly 120 Hz, twice the frequency of the 60 Hz cosine.
See how the samples jump back and forth
between 1 and -1? And how they capture only
the extremes of each period of the cosine
oscillation? This is the significance of "twice
the highest frequency of the signal" value for
sampling frequency.
50. Aliasing Understanding through MATLAB
T = 1/70;
nmin = ceil(tmin / T);
nmax = floor(tmax / T);
n = nmin:nmax;
x1 = cos(2*pi*f * n*T);
plot(t, x_c)
hold on
plot(n*T, x1, 'o')
hold off
50
Chapter 4: Sampling of Continuous-Time Signals
Sampling frequency at 70 Hz.
The samples above look like they
actually could have come from a 10 Hz
cosine signal, instead of a 60 Hz cosine
signal. (Nyquist Criterion not followed)
51. Aliasing Understanding through MATLAB
T = 1/70;
x_c = cos(2*pi*10 * t);
nmin = ceil(tmin / T);
nmax = floor(tmax / T);
n = nmin:nmax;
x1 = cos(2*pi*f * n*T);
plot(t, x_c)
hold on
plot(n*T, x1, 'o')
hold off
51
Chapter 4: Sampling of Continuous-Time Signals
Sampling frequency at 70 Hz.
You can see that it worked perfectly for
a 10 Hz cosine signal, because now the
signal is following Nyquist Criterion
52. Aliasing Understanding through MATLAB
52
Chapter 4: Sampling of Continuous-Time Signals
Conclusion
That's the heart of the "problem" of aliasing. Because the sampling
frequency was too low, a high-frequency cosine looked like a low-
frequency cosine after we sampled it.
53. BGL/SNU
Sampling
<Input> )
(t
xc )
(
j
Xc
<Impulse train>
)
(
)
(
)
( t
s
t
x
t
x c
s
)
(
)
( nT
t
t
x
n
c
<Impulsed input>
)
(
*
)
(
2
1
)
(
j
S
j
X
j
X c
s
)
(
*
)
(
1
n
s
c k
j
X
T
)
]
[
(
1
n
s
c k
j
X
T
n
nT
t
t
s )
(
)
(
)
(
2
)
( s
k
T
j
S
:
2
T
s
Sampling
frequency
)
(
)
( nT
t
t
x
n
c
Example 2
54. BGL/SNU
<output>
)
(
*
)
(
)
( t
y
t
h
t
y s
r
r
)
(
)
(
)
(
j
Y
j
H
j
Y s
r
r
))
(
(
1
)
( s
k
j
Y
T
j
H
k
c
r
)
(
j
Yc
If )
(
j
Hr
is an ideal LPF
Nyquist Sampling Theorem
When xc (t) is bandlimited s.t.
c
c j
X
|
|
,
0
)
(
If we do sampling by taking
Then xc (t) is uniquely reconstructed from x[n]= xc (nT)
,
2 c
s
2
s
2
s
T
55. )
(
j
S
)
(
j
Hr
Illustration of Sampling
)
(
j
Xc
)
(t
Xc
t
2
s
c
s
)
(
j
X s
c
c
s
0
T
1
T
1
2
s
c
s
0
T
2
)
(t
Xs
t
)
(t
S
t
0 T ...
1
c
c
57. Example: The effect of aliasing in the sampling of cosine signal
Suppose
57
0
( ) cos( )
c
x t t
Chapter 4: Sampling of Continuous-Time Signals
58. Nyquist Sampling Theorem
58
• Sampling theorem describes precisely how much information is
retained when a function is sampled, or whether a band-limited
function can be exactly reconstructed from its samples.
• Sampling Theorem: Suppose that is band-limited
to a frequency interval , i.e.,
Then xc(t) can be exactly reconstructed from equidistant samples
where is the sampling period, is the sampling
frequency (samples/second), is for radians/second.
( ) ( )
c C
x t X j
,
N N
( ) 0 for
C N
X j
( )
C
X j
N
N
0
[ ] ( ) (2 / )
c s c s
x n x nT x n
s
s T
f /
1
2
s N
s
s
T
/
2
s
s T
/
2
Chapter 4: Sampling of Continuous-Time Signals
59. BGL/SNU
Illustration of aliasing
t
t
xc
4000
cos
)
(
4000
0
2000
0
f
Sampling period
s
T
2
1500
1
3000
s 1500
s
f
Then the reconstructed output has 1000 component
1000
'
0
500
'
0
f
(note, to avoid aliasing, )
8000
2
c
s
0
-4 1 2 3 4 (*1000)
61. Oversampled
Suppose that is band-limited:
Then if is sufficiently small, appears as:
Condition:
61
( ) ( )
c C
x t X j
S
T ( )
j
X e
2 or or 2
N S N S N S S N
T T T
( )
C
X
A
N
N
0
0
( )
j
X e
N S
T
N S
T
2
2
s
T
A
Chapter 4: Sampling of Continuous-Time Signals
62. Critically Sampled
62
Critically sampled: or 2
N S S N
T
According to the Sampling Theorem, in general the signal cannot be
reconstructed from samples at the rate .
This is because of errors will occur if , the folded
frequencies will add at
Consider the case:
and note that for
( ) sin( ) ( ) ( )
c N N N
x t A t Aj
( )
j
X e
s
T
A
0
2
2
/
S N
T
( ) 0
c N
X
.
/ .
S N
T
( ) sin( ) sin( ) 0 (for all )
s c s
x nT A nT A n n
Chapter 4: Sampling of Continuous-Time Signals
63. Under sampled (aliased)
63
If sampling theorem condition is not satisfied or 2
N S S N
T
• The frequencies are folded - summed. This changes the shape of the
spectrum. There is no process whereby the added frequencies can be
discriminated - so the process is not reversible.
• Thus, the original (continuous) signal cannot be reconstructed exactly.
Information is lost, and false (alias) information is created.
• If a signal is not strictly band-limited, sampling can still be done at twice the
effective band-limited.
( )
j
X e
s
T
A
0
2
2
Chapter 4: Sampling of Continuous-Time Signals
64. 4.3 Reconstruction of a Bandlimited Signal from
Its Samples
Figure(a) represents an ideal
reconstruction system.
Ideal reconstruction filter has
the gain of T and cutoff
frequency
we choice
.
This choice is appropriate for
any relationship between
and .
64
c
N C S N
/ 2 /
C S T
S
N
Chapter 4: Sampling of Continuous-Time Signals
65. Reconstruction of a Bandlimited Signal from Its
Samples
Therefore
65
( ) [ ] ( )
( ) [ ] ( )
sin( / )
( )
/
sin( ( ) / )
( ) [ ]
( ) /
S
n
r r
n
r
r
n
x t x n t nT
x t x n h t nT
t T
h t
t T
t nT T
x t x n
t nT T
Chapter 4: Sampling of Continuous-Time Signals
66. Ideal D/C Converter
The properties of the ideal D/C converter are most easily seen in
the frequency domain.
66
( ) [ ] ( ) ( ) [ ] ( )
( ) ( ) [ ]
j Tn
r r r r
n n
j Tn
r r
n
x t x n h t nT X j x n H j e
X j H j x n e
( ) ( ) ( )
j T
r r
X j H j X e
Chapter 4: Sampling of Continuous-Time Signals
67. 4.4.1 LTI Discrete-Time systems
In general if the discrete-time system is LTI and if the
sampling frequency is above the Nyquist rate
associated with the band width of the input xc(t), then
the overall system will be equivalent to a LTI
continuous-time system with an effective frequency
response given by:
67
( ) ( ), /
( ) ( ) ( )
0, /
( ), /
( )
0, /
j T
C
r eff C
j T
eff
H e X j T
Y j H j X j
T
H e T
H j
T
Chapter 4: Sampling of Continuous-Time Signals
68. Example: Ideal Continuous-Time Lowpass Filtering Using a
Discrete-Time Lowpass Filter
68
1,
( )
0,
C
j
C
H e
1,
( )
0,
C
eff
C
T
H j
T
Chapter 4: Sampling of Continuous-Time Signals
69. Example: Ideal Continuous-Time Lowpass Filtering Using a
Discrete-Time Lowpass Filter
69
Chapter 4: Sampling of Continuous-Time Signals
70. 4.6 Changing the sampling rate using discrete-time processing
We have seen that a continuous-time signal can be represented by a
discrete-time signal.
It is often necessary to change the sampling rate of x[n] and obtain a
new discrete-time signal such that
One approach is to reconstruct and then resample it with
period, but it is of interest to consider methods that involve only
discrete time operations.
70
[ ] ( )
c
x n x nT
[ ] ( )
c
x n x nT
( )
c
x t
Chapter 4: Sampling of Continuous-Time Signals
71. 4.6.1 Sampling rate reduction by an integer factor
Discrete-time sampler or compressor
If then is an exact
representation of
Downsampling: the operation of reducing the sampling
rate (including any filtering).
71
[ ] [ ] ( )
d c
x n x nM x nMT
( ) 0
C N
X j for
[ ]
d
x n
( ) / /
c N
x t iff T MT
Chapter 4: Sampling of Continuous-Time Signals
72. Frequency domain relation between the
input and output of the compressor
72
1
0
1
( / 2 / )
0
1 2
[ ] ( ) ( ) ( ( ))
1 2
[ ] ( ) ( ) ( ( ))
, 0 1
1 1 2 2
( ) ( ( ))
1
( ) ( )
j
c C
k
j
d c d C
r
M
j
d C
i k
M
j j M i M
d
i
k
x n x nT X e X j
T T T
r
x n x nMT X e X j
MT MT MT
r i kM k i M
k i
X e X j
M T MT T MT
X e X e
M
Chapter 4: Sampling of Continuous-Time Signals
73. Down Sampling
73
a) Shows a Fourier Transform of a bandlimited signal
b) Fourier Transform of impulse train of samples when sampling with T
c) Shows
d) Figure (b) and (c) differ only in scaling of the frequency variable
e) Shows DTFT of down sampled sequence when M=2,
f) In this example,
• Original sampling rate is exactly twice the minimum rate to avoid aliasing
• Using the given expression, we know,
Substituting , we have,
𝑋(𝑒𝑗𝜔
𝜔 = 𝛺𝑇′
2𝜋
𝑇
= 4𝛺𝑁
𝜔𝑁 = 𝛺𝑁𝑇
𝛺𝑁
𝜔𝑁 = 𝜋 2
76. Down sampling with aliasing
76
Chapter 4: Sampling of Continuous-Time Signals
77. 4.6.2 Increasing the sampling rate by an integer factor
We will refer to the operation of increasing the sampling rate upsampling
The system on the left is called a sampling rate expander. Its output is
The system on the right is a lowpass discrete-time filter with cutoff frequency
and gain L.
77
[ ] [ / ] ( / ) 0, , 2 ,...
i c
x n x n L x nT L n L L
[ / ], 0, , 2 ,...
[ ]
0,
[ ] [ ] [ ]
e
e
k
x n L n L L
x n
otherwise
x n x k n kL
/ L
Chapter 4: Sampling of Continuous-Time Signals
78. Increasing the sampling rate by an integer factor
This system is an
interpolator because of it fills in
the missing samples.
78
( ) [ ] [ ] [ ] ( )
j j n j Lk j L
e
n k k
X e x k n kL e x k e X e
Chapter 4: Sampling of Continuous-Time Signals
79. Increasing the Sampling Rate by an Integer Factor
If the input sequence was obtained by
sampling without aliasing then is correct for
all n, And is obtained by oversampling of .
79
[ / ], 0, , 2 ,...
[ ]
0,
[ ] [ ] [ ]
sin( / )
[ ]
/
sin( ( )/ )
[ ] [ ]
( )/
[ ] [ / ] ( / ) ( ) 0, , 2 ,...
i
e
e
k
i
k
i c c
x n L n L L
x n
otherwise
x n x k n kL
n L
h n
n L
n kL L
x n x k
n kL L
therefore x n x n L x nT L x nT n L L
[ ] ( )
c
x n x nT
[ ] ( )
i c
x n x nT
( )
c
x t [ ]
i
x n
Chapter 4: Sampling of Continuous-Time Signals
80. 4.6.3 Changing the Sampling Rate by a Non integer Factor
By combining decimation and interpolation it is possible to
change the sampling rate by a noninteger factor.
The interpolation and decimation filter can be combined
together.
80
Chapter 4: Sampling of Continuous-Time Signals
81. Changing the Sampling Rate by a Non integer Factor
81
Chapter 4: Sampling of Continuous-Time Signals
82. Down Sampling
82
x=[1 2 4 6 8 10 12 16];
n=[0: length(x)-1];
factor=input('samping by factor:');
x_downsampled=[ ];
for i=1:factor:length(x)
x_downsampled=[x_downsampled x(i)];
end
grid on
subplot 211
stem(n, x);
xlabel('n')
ylabel('value')
title('original signal')
grid on
subplot 212
stem(0:length(x_downsampled)-1,x_downsampled);
xlabel('n')
ylabel('v')
title('downsampled signal signal')
grid on
83. Up Sampling
83
x=[1 2 3 4 5]
n=[0: length(x)-1]
factor=input('samping by factor:')
x_upsampled=[ ]
for i=1:length(x)
x_upsampled=[x_upsampled x(i)]
for j=1:factor-1
x_upsampled=[x_upsampled 0]
end
end
subplot 211
stem(n, x)
xlabel('n')
ylabel('value')
title('original signal')
subplot 212
stem(0:length(x_upsampled)-1,x_upsampled)
xlabel('n')
ylabel('v')
title('upsampled signal')