Professional Documents
Culture Documents
Exp 1
Exp 1
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;
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