Sie sind auf Seite 1von 5

EXPERIMENT 1

AIM:
To familiarize the students with MATLAB and the basic concept of signals in the MATLAB.
Following are the main features of the experiment.
Introduction to MATLAB
Plotting of Continuous and Discrete time signals on MATLAB.

REQUIREMENTS:MATLAB
Introduction to MATLAB:
What is MATLAB?
MATLAB is a high-level technical computing language equipped with a user-friendly
interface. Its name stems from the words MATrix and LABoratory as it is based on the use of
matrices. MATLAB is an extremely powerful tool useful for scientists and engineers from
various disciplines. For example, MATLAB can be used in a wide range of applications, such
as telecommunications, signal and image processing, control, mathematics, financial
modelling, bioengineering, aeronautics, and many more.

LAB TASK: (Script file)


% Program to understand the use of script file
clc
close all
clear all
% All commands that are
% needed are typed in the
% .m File. Everything written
% at the right of symbol %
% is a comment and is not
% taken into account
t=-5:0.1:5;
f=t.*cos(2*pi*t);
plot(t,f);
Useful Commands
The command sum returns the sum of the elements of a vector. The command cumsum
returns a vector whose elements are the comulative sum of the previous elements, the
command prod is the product of the vector elements, while the command diff returns a vector
in which each element is given by its subtraction with the previous element. The command
max and min return the largest and smallest elements of the vector,respectively, as well as
their index. The command sort sorts the vector elements in ascending(by default) or
descending order. The command mean computes the mean value, while the command median
returns the median value.
The command ones(M,N) creates a matrix of size MxN with ones. Typing ones(M) returns a
square matrix with ones. Similarly, the command zeros(M,N) creates a matrix of size MxN
with zeros. The command rand(M,N) returns an MxN matrix with random elements. The
command eye(M,N) defines an MxN matrix with ones in the main diagonal zeros
everywhere. The command magic(M) creates a square matrix with the property that the sum
of each row or column is equal.
Plotting Signals in MATLAB
LAB TASK:
1.)Plot y(x)=x2
% Program to understand the two dimension plot
% Muhammad Usman Iqbal
% EEE223 Signals and Systems
clc
close all
clear all
x=-2:2 % independent variable , length of the plot
length (x)
y=x.^2 % Function
length (y)
plot(x,y)
2.)Plot y(n)=n2
clear all
close all
n = -3:3
f= n.^2
stem(n,f)
xlabel('Time Axis')
ylabel('Amplitude')
title('Graph of f(n)')

PERFORM:
Plot continuous and discrete signals of sin and cos functions with different periods and
amplitudes.
CONCLUSION:
Thus, MATLAB introduction and plotting of signals is successfully completed.
EXPERIMENT 2
AIM:
To familiarize the students basic signals using MATLAB. Following are the main features of
the experiment.
Basic Continuous and Discrete time Signals

REQUIREMENTS:MATLAB
LAB TASKS:
1.)Unit Step Signal:
t=-10:0.01:10; % step is small enough to represent continuous-time signal
step= t>=0; % the unit step function.
plot(t,f)

2.)Unit Impulse Signal:


t = (-1:0.01:1)';
impulse=t==0
plot(impulse)
3.)Ramp Signal:
t = (-1:0.01:1)';
unitstep=t>=0
ramp=t.*unitstep
plot(ramp)

PERFORM:
1.) Plot all the above signals in discrete domain.
2.) Plot y(t)=3sin(t)u(t)
3.) Plot triangular and square wave in continuous domain.
CONCLUSION:
Thus, plotting of basic signals in continuous and discrete domain is successfully completed.

Das könnte Ihnen auch gefallen