Download as pdf or txt
Download as pdf or txt
You are on page 1of 5

EXPERIMENT-01

BASIC SIGNALS IN CONTINUOUS TIME DOMAIN & DISCRETE TIME DOMAIN


AIM: To implement basic signals in continuous time domain and discrete time domain using
MATLAB software.
PROCEDURE:
1. Open MATLAB Software
2. Click on new->click on script
3. Type the program
4. Save the file with .m extension
5. Click on run button to run the program
6. Give necessary values through command window to get desired output
7. Refer figure window to view the output plots
ALGORITHM:
1. Enter the frequency and amplitude
2. Implement different signals like sine, cosine, square, sawtooth, unit step and unit ramp
signals using in built MATLAB functions
3. Use plot and stem inbuilt MATLAB commands to view the signals in continuous time
domain and discrete time domains respectively
PROGRAM:
a) Continuous time domain:
t=(0:0.01:1);
f=input("Enter the frequency:");
a=input("Enter the amplitude:");
sgtitle("Continuous time domain");

subplot(3,2,1);
y=a*sin(2*pi*f*t);
plot(t,y);
xlabel("time");
ylabel("amplitude");
title("sine wave");
grid on;

subplot(3,2,2);
y=a*cos(2*pi*f*t);
plot(t,y);
xlabel("time");
ylabel("amplitude");
title("cosine wave");
grid on;

subplot(3,2,3);
y=a*square(2*pi*f*t);
plot(t,y);
xlabel("time");
ylabel("amplitude");
title("square wave");
grid on;

subplot(3,2,4);
y=a*sawtooth(2*pi*f*t);
plot(t,y);
xlabel("time");
ylabel("amplitude");
title("sawtooth signal");
grid on;

subplot(3,2,5);
y=t>=0;
plot(t,y);
xlabel("time");
ylabel("amplitude");
title("unit step signal");
grid on;

subplot(3,2,6);
plot(t,t);
xlabel("time");
ylabel("amplitude");
title("unit ramp signal")
grid on;

b) Discrete time domain:

t=(0:0.01:1);
f=input("Enter the frequency:");
a=input("Enter the amplitude:");
sgtitle("Discrete time domain");

subplot(3,2,1);
y=a*sin(2*pi*f*t);
stem(t,y);
xlabel("time");
ylabel("amplitude");
title("sine wave");
grid on;

subplot(3,2,2);
y=a*cos(2*pi*f*t);
stem(t,y);
xlabel("time");
ylabel("amplitude");
title("cosine wave");
grid on;

subplot(3,2,3);
y=a*square(2*pi*f*t);
stem(t,y);
xlabel("time");
ylabel("amplitude");
title("square wave");
grid on;

subplot(3,2,4);
y=a*sawtooth(2*pi*f*t);
stem(t,y);
xlabel("time");
ylabel("amplitude");
title("sawtooth signal");
grid on;

subplot(3,2,5);
y=t>=0;
stem(t,y);
xlabel("time");
ylabel("amplitude");
title("unit step signal");
grid on;

subplot(3,2,6);
stem(t,t);
xlabel("time");
ylabel("amplitude");
title("unit ramp signal")
grid on;

RESULT: Hence, implemented the basic signals in continuous time domain and discrete time
domain using MATLAB software

You might also like