0% found this document useful (0 votes)
11 views

Exp 1

exp 1 of sns

Uploaded by

devansh.kawate23
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views

Exp 1

exp 1 of sns

Uploaded by

devansh.kawate23
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 13

Name: Devansh Kawate

Uid: 2023200065
Batch: A4

EXPERIMENT NO. 1

Aim: To study and plot continuous time signals x(t)

Objective (A): To plot ELEMENTARY continuous time signals x(t)

Software Table:

Sr. No. Software Version Vendor Installation FOSS/Licensed


Name Size (If Licensed,
Details of
License)

1) Matlab R2024a MathWorks 30 GB Recurring License

Matlab Code:

%program to generate elementary signals

clear all
clc

t=-10:0.25:10; %defination of time scale

%defination of unit impulse


x=dirac(t);
figure(1);
subplot(2,2,1)
plot(t,x,'r')
xlabel('TIME AXIS')
ylabel('FUNCTION AXIS--->')
title('UNIT IMPULSE')
grid on

%defination of unit step


x=heaviside(t);
figure(1);
subplot(2,2,2)
plot(t,x,'m')
xlabel('TIME AXIS')
ylabel('FUNCTION AXIS--->')
title('UNIT STEP')
grid on
%defination of unit ramp
x=t.*heaviside(t); %bitwise mult
figure(1);
subplot(2,2,3)
plot(t,x,'k')
xlabel('TIME AXIS')
ylabel('FUNCTION AXIS--->')
title('UNIT RAMP')
grid on

%defination of exponential decay


x=exp(-t);
figure(1);
subplot(2,2,4)
plot(t,x,'r')
xlabel('TIME AXIS')
ylabel('FUNCTION AXIS--->')
title('Exponential deacy')
grid on

%defination of exponential rise


x=exp(t);
figure(2);
subplot(2,2,1)
plot(t,x,'r')
xlabel('TIME AXIS')
ylabel('FUNCTION AXIS--->')
title('Exponential rise')
grid on

%defination of sin wave


x=sin(t);
figure(2);
subplot(2,2,2)
plot(t,x,'r')
ylim([-1.5,1.5])
xlabel('TIME AXIS')
ylabel('FUNCTION AXIS--->')
title('Sin Wave')
grid on

%defination of cos wave


x=cos(t);
figure(2);
subplot(2,2,3)
plot(t,x,'k')
ylim([-1.5,1.5])
xlabel('TIME AXIS')
ylabel('FUNCTION AXIS--->')
title('Cos Wave')
grid on

%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 square wave


t=-10:0.5:10;
x=square(t);
figure(3);
subplot(2,2,1)
plot(t,x,'k')
ylim([-1.5,1.5])
xlabel('TIME AXIS')
ylabel('FUNCTION AXIS--->')
title('Square Wave')
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:

%program to generate elementary signals

clear all
clc

t=-10:0.05:10; %defination of time scale

%defination of sin wave


x=sin(t);
figure(1);
subplot(3,2,1)
plot(t,x,'r')
xlabel('TIME AXIS-->')
ylabel('FUNCTION AXIS-->')
title('Sin Wave')
grid on

%defination of time shifting advance


x=sin(t);
figure(1);
subplot(3,2,2)
plot(t,x,'r')
hold on

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

%defination of time shifting delay


x=sin(t);
figure(1);
subplot(3,2,3)
plot(t,x,'r')
hold 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

%defination of time scaling


x=sin(t);
figure(1);
subplot(3,2,4)
plot(t,x,'r')
hold on
x=sin(2*t);
figure(1);
subplot(3,2,4)
plot(t,x,'b')
hold off
xlabel('TIME AXIS-->')
ylabel('FUNCTION AXIS-->')
title('Time Scaling')
grid on

%defination of multiply by constant


x=2*sin(t);
figure(1);
subplot(3,2,5)
plot(t,x,'r')
hold 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:

%program to generate complex signals using elementary signal

close all;
clc;

% Define the axix width


t = -20:0.1:20;

% Define the required ramp function


ramp = t .* (t >= 0);
ramp2 = (t-4) .* ((t-4) >= 0);

% Define the requird step functions.


step = t >= 0;
step2 = t-6 >= 0;
step3 = t-8 >= 0;
plot(t, ramp-ramp2 +4*step2-8*step3, 'LineWidth', 2); % Plot unit step
xlabel('width');
ylabel('Amplitude');
grid on;
axis([-10 20 -10 20]); % Set axis limits
Output:

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.

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy