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 32 33
| close all; clc;
% Zero order holder:
%<a href="http://www.ece.iastate.edu/~namrata/EE424/l1.pdf" target="_blank">http://www.ece.iastate.edu/~namrata/EE424/l1.pdf</a>
% <a href="http://control.ucsd.edu/mauricio/courses/mae143a/lectures/8sampling.pdf" target="_blank">http://control.ucsd.edu/mauricio/cou.../8sampling.pdf</a>
M=2.1234567654; % Nb de points par période de la sinusoide : M>2 (condition de Shannon)
% Time domain
tStart = 0; tStep = 0.01; tEnd = 200; t = tStart:tStep:tEnd;
% Original signal
x = @(t)(sin(2*pi*t/M));
% Sampling period
Ts = 5e-2;
% Impulse ZOH
zohImpl = ones(1,Ts/tStep);
% Samples
nSamples = tEnd/Ts; samples = 0:nSamples;
% Sampled signal
xSampled = zeros(1,length(t));
xSampled(1:Ts/tStep:end) = x(samples*Ts);
% Convolution with impulse response
xZoh1 = conv(zohImpl,xSampled);
xZoh1 = xZoh1(1:length(t));
% Plot
figure(4); hold all; plot(t,x(t)); stem(t,xSampled); plot(t,xZoh1); |
Partager