Program No. 1: Table1.1: Matlab Window
Program No. 1: Table1.1: Matlab Window
1
AIM: Introduction to MATLAB
The name MATLAB stands for MATRIX
LABORATORY.
MATLAB was written originally to provide easy access to matrix
software developed by the LINPACK (linear system package) and
EISPACK (Eigen system package) projects.
MATLAB is a high-performance language for technical computing. It
integrates computation, visualization, and programming environment.
Furthermore, MATLAB is a modern programming language
environment it has sophisticated data structures, contains built-in
editing and debugging tools, and supports object-oriented
programming. These factors make MATLAB an excellent tool for
teaching and research.
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:
TABLE1.1: MATLAB WINDOW
Window
Command Window
Figure Window
Editor Window
Help Window
Command History Window
Workspace Window
Current Folder Window
Purpose
Main window, enter variable, runs
programs.
Contains output from graphic
command.
Creates and debugs script and
function files.
Provide help information.
Logs commands entered in the
command window.
Provide the information about the
variables that are used.
Shows the files in the current
folder.
Symbol
+
*
/
^
Operation
Addition
Subtraction
Multiplication
Division
Exponentiation
Example
2+3
2-3
2*3
2/3
2^3
cos(x) Cosine
sin(x) Sine
tan(x) Tangent
acos(x) Arc cosine
asin(x) Arc sine
atan(x) Arc tangent
exp(x) Exponential
sqrt(x) Square root
log(x) Natural logarithm
log10(x) Common logarithm
Graphing functions
Label the horizontal axis
Label the vertical axis
Attach a title to the plot
Change the limits on the x and y axis
Keep plotting in the same window.
Turn off the Keep plotting in the same window
command
MATLAB command
Xlabel (text)
Ylabel (text)
Title (text)
Axis ([xmin, xmax
ymin ymax])
hold on
hold off
clear all;
close all;
N=30;
n=-N:1:N;
x=[zeros(1,N+1) ones(1,N)]
subplot(2,3,1),plot(n,x,'green');
xlabel('Time');
ylabel('Amplitude');
title('unit Step');
n=-N:1:N
x1=[zeros(1,N) ones(1,1) zeros(1,N)];
subplot(2,3,2),plot(n,x1,'red');
xlabel('Time');
ylabel('Amplitude');
title('unit Impluse');
a=1:N
x2=[zeros(1,N+1),a];
subplot(2,3,3),plot(n,x2,'yellow');
xlabel('Time');
ylabel('Amplitude');
title('unit Ramp');
n=-N:1:N;
x=[zeros(1,N+1) ones(1,N)]
subplot(2,3,4),stem(n,x,'green');
xlabel('Time');
ylabel('Amplitude');
title('unit Step');
n=-N:1:N
x1=[zeros(1,N) ones(1,1) zeros(1,N)];
subplot(2,3,5),stem(n,x1,'red');
xlabel('Time');
ylabel('Amplitude');
title('unit Impluse');
a=1:N
x2=[zeros(1,N+1),a];
subplot(2,3,6),stem(n,x2,'yellow');
xlabel('Time');
ylabel('Amplitude');
title('unit Ramp');
0utput:
Program:3
AIM: Write a program to plot sine wave and cosine wave.
Program:
clc;
clear all;
close all;
f=input('enter the frequency in Hz');
t=0:.0001:5;
y=sin(2*pi*f*t);
subplot(1,2,1);
plot(t,y);
ylabel('amplitude');
xlabel('time index');
title('sine wave')
f=input('enter the frequency in Hz');
t=0:.0001:5;
y=cos(2*pi*f*t);
subplot(1,2,2);
plot(t,y);
ylabel('amplitude');
xlabel('time index');
title('cosine wave')
Output:
Lab manual
For
signal and system
programs
1. Introduction to MATLAB
2. To plot basic signals
3. To plot complex exponential
& real sinusoids
Submitted to
Submitted by
Kavita devi
Ece department
251551002