Signal Flipping
clear n=‐1:1/1000:1;
x1=5*sin(2*pi*1*n);
subplot(2,1,1);
plot(n,x1, 'g', 'linewidth',2);
axis([‐1 1 ‐5 5]);
xlabel('time'); ylabel('signal amplitude');
title('Original sine wave'); grid;
subplot(2,1,2);
plot(‐n,x1, 'r', 'linewidth',2); axis([‐1 1 ‐5 5]);
xlabel('time'); ylabel('signal amplitude'); title('Flipped sine wave'); grid;
clear n=1:7;
x=[1 2 2 3 2 2 1];
subplot(2,1,1);
stem(n,x, 'filled'); title('Original signal'); xlabel('Time index'); ylabel('Signal Amplitude'); axis([1 7 0 4]);
grid;
S=2;
subplot(2,1,2);
stem(n,S*x, 'filled'); title('Amplitude Scaled signal'); xlabel('Time index'); ylabel('Signal Amplitude'); axis([1 7 0 8]); grid;
Task 6
Scale the continuous‐time sinusoid used in signal shifting example by a factor of 2.
Time Scaling
%Decimation (down‐
sampling) clear
n=‐2:1/1000:2;
x1=sin(2*pi*2*n); x2=decimate(x1,2);
subplot(2,1,1); plot(x1); title('Original signal');
xlabel('Sample Number'); ylabel('Signal Amplitude');
axis([0 4000 ‐1
1]); grid;
subplot(2,1,2);
plot(x2); title('Decimated signal'); xlabel('Sample Number'); ylabel('Signal Amplitude'); axis([0 2000
‐1 1]);
grid;
Task 2
Use interp command in the above program to interpolate (up‐sample) the signal by a factor of 2.
Laboratory Manual
Dostları ilə paylaş: |