0% found this document useful (0 votes)
0 views12 pages

Exp 1 212

The document provides MATLAB programs for generating various types of signals including sine, cosine, ramp, square, exponential, unit step, and unit impulse signals. It also includes operations on signals such as addition, multiplication, scaling, folding, and shifting. Each section contains code snippets and descriptions of the output for visualizing the generated signals and their operations.

Uploaded by

Konda Anish teja
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as RTF, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
0 views12 pages

Exp 1 212

The document provides MATLAB programs for generating various types of signals including sine, cosine, ramp, square, exponential, unit step, and unit impulse signals. It also includes operations on signals such as addition, multiplication, scaling, folding, and shifting. Each section contains code snippets and descriptions of the output for visualizing the generated signals and their operations.

Uploaded by

Konda Anish teja
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as RTF, PDF, TXT or read online on Scribd
You are on page 1/ 12

GENERATION OF SIGNAL AND SEQUENCE

1)GENERATION OF SINE WAVE

PROGRAM:

clc;
close all;
t=0:0.01:1;
y=sin(2*pi*t);
subplot(2,1,1);
plot(y);
axis tight;
xlabel('Angle');
ylabel('Amplitude');
title('SINE WAVE');
grid on;
subplot(2,1,2);
stem(y);
axis tight;
xlabel('Angle');
ylabel('Amplitude');
title('SINE SEQUENCE');
grid on;

OUTPUT:
2)GENERATION OF COSINE WAVE

PROGRAM:

clc;
close all;
t=0:0.01:1;
y=cos(2*pi*t);
subplot(2,1,1);
plot(y);
axis tight;
xlabel('Angle');
ylabel('Amplitude');
title('COSINE WAVE');
grid on;
subplot(2,1,2);
stem(y);
axis tight;
xlabel('Angle');
ylabel('Amplitude');
title('COSINE SEQUENCE');
grid on;

OUTPUT:

3)GENERATION OF RAMP SEQUENCE

PROGRAM:
clc;
close all;
t=0:1:8;
y=t.*(t>=0);
subplot(2,1,1);
plot(t,y);
axis tight;
xlabel('time');
ylabel('Amplitude');
title('RAMP SIGNAL');
grid on;
subplot(2,1,2);
plot(t,y);
stem(t,y);
axis tight;
xlabel('Angle');
ylabel('Amplitude');
title('RAMP SEQUENCE');
grid on;

OUTPUT:

4)GENERATION OF SQUARE WAVE

PROGRAM:
clc;
close all;
n=0:0.01:8;
y=square(2*pi*n);
plot(y);
axis tight;
xlabel('n,.....>');
ylabel('Amplitude');
title('Square sequence');
grid on;
OUTPUT:

5)GENERATION OF EXPONENTIAL SIGNAL

PROGRAM:

clc;

clear ;
close all;
t=0:1:10;
a=0.5;
y1=exp(a*t);
subplot(2,1,1);
plot(t,y1);
axis tight;
xlabel('time');
ylabel('Amplitude');
title('EXPONENTIAL SIGNAL');
grid on;
subplot(2,1,2);
stem(t,y1);
axis tight;
xlabel('time');
ylabel('Amplitude');
title('EXPONENTIAL SEQUENCE');
grid on;

OUTPUT:

6)GENERATION OF unit step sequence

PROGRAM:

clc;
close all;
t=-1:1:6;
y1=(t>=0);
subplot(2,1,1);
plot(t,y1);
axis tight;
xlabel('time');
ylabel('Amplitude');
title('unit step');
grid on;
subplot(2,1,2);
stem(t,y1);
axis tight;
xlabel('time');
ylabel('Amplitude');
title('unit step sequence');
grid on;

OUTPUT:

6)GENERATION OF UNIT IMPULSE SIGNAL

PROGRAM:

clc;
close all;
t=-1:0.05:1;
y=(t==0);
subplot(2,1,1);
plot(t,y);
ylabel("Amplitude");
xlabel("Time");
title("UNIT IMPULSE SIGNAL");
subplot(2,1,2);
stem(t,y);
ylabel("Amplitude");
xlabel("n");
title("UNIT IMPULSE SEQUENCE");

OUTPUT:

EXPERIMENT 2
BASIC OPERATIONS ON SIGNALS AND SEQUENCE
1)PROGRAM FOR ADDITION AND MULTIPLICATION

clc;
clear;
close all;
t=0:0.01:5;
x1=t.*(t>=0);
x2=square(2*pi*t);
subplot(2,2,1);
plot(t,x1);
xlabel('time');
ylabel('amplitude');
title('input signal 1');
subplot(2,2,2);
plot(t,x2);
xlabel('time');
ylabel('amplitude');
title('input signal 2');
% ADDITION
y1=x1+x2;
subplot(2,2,3);
plot(t,y1);
xlabel('time');
ylabel('amplitude');
title('Addition of signals');
grid on;
% MULTIPLICATION
y2=x1.*x2;
subplot(2,2,4);
plot(t,y2);
xlabel('time');
ylabel('amplitude');
title('Multiplication of signals');
grid on;

OUTPUT:

2)PROGRAM FOR SCALING, FOLDING AND SHIFTING


% SCALING
clc;
clear;
close all;
t=0:0.1:5;
b=3;
x1=exp(b*t);
a=2;
y3=a*x1;
subplot(4,4,1);
plot(t,x1);
xlabel('time');
ylabel('amplitude');
title('input signal ');
grid on;
subplot(4,4,2);
stem(t,x1);
axis tight;
xlabel('time');
ylabel('Amplitude');
title('output sequence');
grid on
subplot(4,4,5),
plot(t,y3);
xlabel('time');
ylabel('amplitude');
title('Amplified signal');
grid on;
subplot(4,4,6);
stem(t,y3);
axis tight;
xlabel('time');
ylabel('Amplitude');
title('output sequence');
grid on;
%FOLDING
h=length(x1);
nx=0:h-1;
y4=flip(x1);
nf=-fliplr(nx);
subplot(4,4,9);
plot(nf,y4);
xlabel('nf');
ylabel('Amplitude');
title('FOLDED SIGNAL');
grid on;
subplot(4,4,10);
stem(t,y4);
axis tight;
xlabel('nf');
ylabel('Amplitude');
title('output sequence');
grid on;
% SHIFTING
subplot(4,4,13);
plot(t+2,x1);
xlabel('t+2');
ylabel('Amplitude');
title('SHIFTED SIGNAL');
grid on;
subplot(4,4,14);
stem(t+2,x1);
axis tight;
xlabel('t+2');
ylabel('Amplitude');
title('output sequence');
grid on;

OUTPUT:

You might also like