Embed presentation
Download to read offline

![close all;
clc;
k=2;
x1=[1 2 3 4 5];
a=length(x1);
n=0:1:a-1;
subplot(3,1,1);
stem(x1);
xlabel('number of samples');
ylabel('amplitude');
title('input signal');
x2=k*x1;
subplot(3,1,2);
stem(x2);
xlabel('number of samples');
ylabel('amplitude');
title('compresion signal');
x3=x1/k;
subplot(3,1,3);
stem(x3);
xlabel('number of samples');
ylabel('amplitude');
title('expansion signal');
display(x1);
display(x2);
display(x3);](https://image.slidesharecdn.com/electronicsandcommunicationengineering-1-171023061806/75/MATLAB-program-of-expansion-and-compression-of-signal-2-2048.jpg)


This MATLAB program expands and compresses a sample signal using a scaling factor of 2. The original signal is plotted, then compressed by multiplying by 2 and expanded by dividing by 2. The compressed and expanded signals are plotted alongside the original for comparison. The program displays the original, compressed, and expanded signal values.

![close all;
clc;
k=2;
x1=[1 2 3 4 5];
a=length(x1);
n=0:1:a-1;
subplot(3,1,1);
stem(x1);
xlabel('number of samples');
ylabel('amplitude');
title('input signal');
x2=k*x1;
subplot(3,1,2);
stem(x2);
xlabel('number of samples');
ylabel('amplitude');
title('compresion signal');
x3=x1/k;
subplot(3,1,3);
stem(x3);
xlabel('number of samples');
ylabel('amplitude');
title('expansion signal');
display(x1);
display(x2);
display(x3);](https://image.slidesharecdn.com/electronicsandcommunicationengineering-1-171023061806/75/MATLAB-program-of-expansion-and-compression-of-signal-2-2048.jpg)
