1. LAB NO. 01
Introduction to MATLAB
Lab Task
Introduction:
The name MATLAB stands for Matrix Laboratory. MATLAB is a high-performance language
for technical computing. It integrates computation, visualization, and programming
environment. Furthermore, MATLAB is a modern programming language environment.
We use the MATLAB in communication system subject as a signal operation and perform
different operation like signal generation, arithmetic operation, matrices operation and complex
signal operation etc.
When you start MATLAB, a special window called the MATLAB desktop appears. The
desktop is a window that contains other windows. The major tools within or accessible from
the desktop are:
• The Command Window
• The Command History
• The Workspace
The Command Window is one of the main tools you use to enter data, run MATLAB
functions and other M-files, and display results.
The Command History window displays a log of statements that you ran in the current and
previous MATLAB sessions. The Command History lists the time and date of each session in
the short date format for your operating system, followed by the statements from that session.
2. The workspace contains variables that you create or import into MATLAB from data files or
other programs.
Q1. 5cos(3t), where time t is from -5 to 5
MATLAB code
>> t=-5:0.01:5;
y= 5*cos(3*t);
xlabel('x-axis')
ylabel('y-axis')
title('5cos(3t)')
3. Q2. plot 5cos(3𝝅t) + 5/2sin
𝟐𝝅𝒕
𝟓
, where time t is from -2𝝅 to 2𝝅
MATLAB code
>> t=-2*pi:0.01:2*pi;
y= 5.*cos(3*pi.*t) + 5/2.*sin(2/5*pi.*t);
plot(t,y)
xlabel('time')
ylabel('amplitude')
title('usman')
Q3. plot cos(2t) and sin(5t) on the same figure,
MATLAB code:
hold on