Exp 1
Exp 1
Uid: 2023200065
Batch: A4
EXPERIMENT NO. 1
Software Table:
Matlab Code:
clear all
clc
%defination of log
x=log(t);
figure(2);
subplot(2,2,4)
plot(t,x,'m')
xlabel('TIME AXIS')
ylabel('FUNCTION AXIS--->')
title('Log')
grid on
%defination of sawtooth
t=-10:0.5:10;
x=sawtooth(t);
figure(3);
subplot(2,2,2)
plot(t,x,'m')
xlabel('TIME AXIS')
ylabel('FUNCTION AXIS--->')
title('Sawtooth Wave')
grid on
%defination of sinc
t=-10:0.5:10;
x=sinc(t);
figure(3);
subplot(2,2,3)
plot(t,x,'r')
ylim([-0.5,1.5])
xlabel('TIME AXIS')
ylabel('FUNCTION AXIS--->')
title('Sinc Wave')
grid on
%defination of signum
t=-10:0.5:10;
x=sign(t);
figure(3);
subplot(2,2,4)
plot(t,x,'k')
xlabel('TIME AXIS')
ylabel('FUNCTION AXIS--->')
title('Signum Wave')
grid on
OUTPUT:
Result:
The generated plots match the expected shapes of elementary signals, including the unit
impulse, step, ramp, and periodic functions like sine, cosine, sawtooth, and square waves. The
results align with theoretical concepts, confirming the correctness of the signal generation.
Objective (B): To perform operations on continuous time signals x(t) and observe the operated
signal y(t).
Matlab Code:
clear all
clc
x=sin(t+2);
figure(1);
subplot(3,2,2)
plot(t,x,'b')
hold off
xlabel('TIME AXIS-->')
ylabel('FUNCTION AXIS-->')
title('Time Shifting Adv')
grid on
x=sin(t-2);
figure(1);
subplot(3,2,3)
plot(t,x,'b')
hold off
xlabel('TIME AXIS-->')
ylabel('FUNCTION AXIS-->')
title('Time Shifting Delay')
grid on
x=sin(t+2);
figure(1);
subplot(3,2,5)
plot(t,x,'b')
hold off
xlabel('TIME AXIS-->')
ylabel('FUNCTION AXIS-->')
title('Mult by Const')
grid on
%defination of clamping
x=sin(t);
figure(1);
subplot(3,2,6)
plot(t,x,'r')
hold on
x=sin(t)+2;
figure(1);
subplot(3,2,6)
plot(t,x,'b')
hold off
xlabel('TIME AXIS-->')
ylabel('FUNCTION AXIS-->')
title('Clamping')
grid on
Output:
Result:
We have successfully generated and displayed different variations of a sine wave which has
been applied with different operations, including delayed, advanced, time-scaled,
constant-multiplied, and clamped. Each variation is plotted for visual analysis using MATLAB.
Objective (C): To generate higher level signals using elementary signals
Matlab Code:
close all;
clc;
Result:
We have successfully generated a complex signal by combining ramp and step functions with
various shifts and scaling operations. The signal is plotted for visual analysis using MATLAB, by
combining various elementary signals by addition and basic operations
Objective (D): To perform Convolution of two continuous-time signals x(t) and h(t)
Matlab Code:
%convolution
clc
close all;
t=-5:1:5;
x=heaviside(t);
subplot(3,1,1);
plot(t,x,'r');
xlabel('Time-->');
ylabel('Time step-->');
title('X(t) ::unit step function');
ylim([-0.5 1.5])
xlim([-3 3])
grid on;
h=heaviside(t);
subplot(3,1,2);
plot(t,x,'r');
xlabel('Time-->');
ylabel('Time step-->');
title('h(t) ::unit step function');
ylim([-0.5 1.5])
xlim([-3 3])
grid on;
%Convolution
S=conv(x,h,'same');
subplot(3,1,3);
plot(t,S);
xlabel('Time-->');
ylabel('Time function-->');
title('Convolution function');
grid on;
Output:
Calculation:
Conclusion:
In this experiment, I utilized MATLAB R2024a to simulate various signals. I explored how to
create elementary continuous time signals and applied operations such as time shifting, scaling,
reversal, multiplication by a constant, and clamping. Additionally, I generated more complex
signals and gained an understanding of convolution.