SlideShare a Scribd company logo
2
Most read
13
Most read
18
Most read
Miss. Patil Apurva Pandurang
M.Tech (Electronics)
1
 x = 0:0.1:2*pi; % first value is 0, last is 2*pi &
incrementad by 0.1
 y = sin(x); % for sin wave
 plot(x,y)
OR
 x= linspace(0,2*pi,1000)
% taking 1000 samples between 0 to 2pi
 y = sin(x); % for sin wave
 plot(y)
0 1 2 3 4 5 6 7
-1
-0.8
-0.6
-0.4
-0.2
0
0.2
0.4
0.6
0.8
1
2
 plot(.)
>> x=linspace(0,2*pi,50);
>>y=sin(x);
>>plot(y)
 stem(.)
>> x=linspace(0,2*pi,50);
>>y=sin(x);
>>stem(y)
0 5 10 15 20 25 30 35 40 45 50
-1
-0.8
-0.6
-0.4
-0.2
0
0.2
0.4
0.6
0.8
1
0 5 10 15 20 25 30 35 40 45 50
-1
-0.8
-0.6
-0.4
-0.2
0
0.2
0.4
0.6
0.8
1
3
 title(.)
>>title(‘This is the sinus function’)
 xlabel(.)
>>xlabel(‘time’)
 ylabel(.)
>>ylabel(‘sin(x)’)
 legend(.)
>>legend ('sin_x')
 grid
>> grid on
>> grid off
 axis([xmin xmax ymin ymax])
Sets the minimum and maximum limits of the x- and y-axes
0 1 2 3 4 5 6 7
-1
-0.8
-0.6
-0.4
-0.2
0
0.2
0.4
0.6
0.8
1
time
sin(x)
This is the sinus function
sin(x)
4
0 1 2 3 4 5 6 7
-1
-0.8
-0.6
-0.4
-0.2
0
0.2
0.4
0.6
0.8
1
time
sin(x) This is the sinus function
sin(x)
Data
signal
X axis
label
grids
Tick
mark
legend
Graph
title
Y axis
label
5
 Multiple x-y pair arguments create multiple
graph
x = 0:pi/100:2*pi;
y = sin(x);
y2 = sin(x-0.25);
y3 = sin(x-0.5);
plot(x,y,x,y2,x,y3)
0 1 2 3 4 5 6 7
-1
-0.8
-0.6
-0.4
-0.2
0
0.2
0.4
0.6
0.8
1
6
 plot(x,y,’line specifiers’)
Define style, color of line
& type of marker
7
Line Specifies Line Specifies Marker Specifies
Style Color Type
Solid - red r plus sign +
dotted : green g circle o
dashed -- blue b asterisk *
dash-dot -. Cyan c point .
magenta m square s
yellow y diamond d
black k
0 1 2 3 4 5 6 7
-1
-0.8
-0.6
-0.4
-0.2
0
0.2
0.4
0.6
0.8
1
Example:
x=0:0.1:2*pi;
y=sin(x);
plot(x,y,'r-*')
8
 fplot(‘function’,[limits])
E.g.
Plot the equation
x^3-2*cos(0.66*x)+4*sin(2*x)-1 in the limit
between -3 & 3
>>fplot('x^3-2*cos(0.66*x)+4*sin(2*x)-1', [-3 3])
-3 -2 -1 0 1 2 3
-30
-20
-10
0
10
20
30
9
Subplots
 subplot(m,n,P)
rows
columns
position
x=0:0.1:2*pi;
y=sin(x);
subplot(2,1,1);
plot(y)
title('sin(x) wave')
y1=cos(x)
subplot(2,1,2);
plot(y1)
title('cos(x) wave')
0 10 20 30 40 50 60 70
-1
-0.5
0
0.5
1
sin(x) wave
0 10 20 30 40 50 60 70
-1
-0.5
0
0.5
1
cos(x) wave
10
0 20 40 60 80
-1
-0.8
-0.6
-0.4
-0.2
0
0.2
0.4
0.6
0.8
1
sin(x) wave
0 20 40 60 80
-1
-0.8
-0.6
-0.4
-0.2
0
0.2
0.4
0.6
0.8
1
cos(x) wavex=0:0.1:2*pi;
y=sin(x);
subplot(1,2,1);
plot(y)
title('sin(x) wave')
y1=cos(x)
subplot(1,2,2);
plot(y1)
title('cos(x) wave')
Example
11
Example:
x=0:0.1:4*pi;
y=sin(x);
subplot(2,2,1);
plot(y)
title('sin(x) wave')
y1=cos(x)
subplot(2,2,2);
plot(y1)
title('cos(x) wave')
y2=sawtooth(x)
subplot(2,2,3);
plot(y2)
title('sawtooth wave')
y3=rand(4)
subplot(2,2,4);
plot(y3)
title('randam wave')
0 50 100 150
-1
-0.5
0
0.5
1
sin(x) wave
0 50 100 150
-1
-0.5
0
0.5
1
cos(x) wave
0 50 100 150
-1
-0.5
0
0.5
1
sawtooth wave
1 2 3 4
0
0.5
1
randam wave
12
Example
clc
clear all
x=0:0.1:4*pi;
y=sin(x);
subplot(2,2,1:2);
plot(y)
title('sin(x) wave')
y2=sawtooth(x)
subplot(2,2,3);
plot(y2)
title('sawtooth wave')
y3=rand(4)
subplot(2,2,4);
plot(y3)
title('randam wave')
0 50 100 150
-1
-0.5
0
0.5
1
sawtooth wave
1 2 3 4
0
0.5
1
randam wave
0 20 40 60 80 100 120 140
-1
-0.5
0
0.5
1
sin(x) wave
13
 bar(x,y)
x=[1 2 3 4 5]
y=[1 2 3 4 5]
bar(x,y)
 function creates
vertical Bar plot 1 2 3 4 5
0
0.5
1
1.5
2
2.5
3
3.5
4
4.5
5
14
 barh(x,y)
x=[1 2 3 4 5]
y=[1 2 3 4 6]
barh(x,y)
 function creates
horizontal Bar plot
0 1 2 3 4 5 6
1
2
3
4
5
15
 stairs(x,y)
x=[0 1 2 3 4]
y=[1 2 3 4 6]
stairs(x,y)
 function creates
stair plot
0 0.5 1 1.5 2 2.5 3 3.5 4
1
1.5
2
2.5
3
3.5
4
4.5
5
5.5
6
16
 compass(x,y)
x=[1 2 3 4 5]
y=[1 2 3 4 6]
compass(x,y)
 function creates polar plot
Location of points to plot in
“Cartesian coordinates”
2
4
6
8
30
210
60
240
90
270
120
300
150
330
180 0
17
 pie(x)
x=[1 2 3 4 5]
pie(x)
 function creates pie plot
 Values are in terms of percentage
7%
13%
20%
27%
33%
18
Thank you…..
19

More Related Content

PPTX
Matlab ploting
PPT
numerical methods
PPTX
The False-Position Method
PPTX
Graph Plots in Matlab
PPTX
Jacobi method
PPTX
False Point Method / Regula falsi method
PPT
Gauss sediel
PPTX
Runge Kutta Method
Matlab ploting
numerical methods
The False-Position Method
Graph Plots in Matlab
Jacobi method
False Point Method / Regula falsi method
Gauss sediel
Runge Kutta Method

What's hot (20)

PPT
Regulafalsi_bydinesh
PPT
Chapter 2 - Matlab Environment
PPTX
2D Plot Matlab
PPTX
Secant method
PPTX
Secant Method
PPTX
Newton's forward difference
PDF
interpolation
PPTX
Initial value problems
PPTX
Application of interpolation in CSE
PDF
Interpolation and-its-application
PPT
Numerical Analysis (Solution of Non-Linear Equations) part 2
PPT
Secant Method
PPTX
Newton's Backward Interpolation Formula with Example
PDF
Curve fitting - Lecture Notes
PPTX
Interpolation and its applications
PPTX
Interpolation
PDF
Optimization Techniques.pdf
PPTX
Stat 2153 Stochastic Process and Markov chain
PPT
Composite transformations
PPTX
3 d transformation
Regulafalsi_bydinesh
Chapter 2 - Matlab Environment
2D Plot Matlab
Secant method
Secant Method
Newton's forward difference
interpolation
Initial value problems
Application of interpolation in CSE
Interpolation and-its-application
Numerical Analysis (Solution of Non-Linear Equations) part 2
Secant Method
Newton's Backward Interpolation Formula with Example
Curve fitting - Lecture Notes
Interpolation and its applications
Interpolation
Optimization Techniques.pdf
Stat 2153 Stochastic Process and Markov chain
Composite transformations
3 d transformation
Ad

Similar to graphs plotting in MATLAB (20)

PPT
Interpolation functions
PDF
Signals and Systems part 2 solutions
TXT
Rfgtopgffffffffffffffffffffffffffffff
PDF
Presentation Sampling adn Reconstruction.pdf
PPT
Newton divided difference interpolation
PDF
assignment_2
PDF
Use the same variable names and write the function F - Force(x-ks-kc-l.pdf
PDF
Amth250 octave matlab some solutions (1)
PPTX
Newton's forward & backward interpolation
PDF
Amth250 octave matlab some solutions (2)
PPTX
The Moore-Spiegel Oscillator
PDF
1. newtonsforwardbackwordinterpolation-190305095001.pdf
PDF
convulution
PDF
22nd BSS meeting poster
PPTX
Digital signal processing
PDF
Solutions for Problems in Fundamentals of Applied Electromagnetics, 8th Globa...
PDF
Signals and systems: part i solutions
PDF
1st and 2nd Semester M Tech: VLSI Design and Embedded System (Dec-2015; Jan-2...
PDF
Perdif Systems of Linear Differential.pdf
Interpolation functions
Signals and Systems part 2 solutions
Rfgtopgffffffffffffffffffffffffffffff
Presentation Sampling adn Reconstruction.pdf
Newton divided difference interpolation
assignment_2
Use the same variable names and write the function F - Force(x-ks-kc-l.pdf
Amth250 octave matlab some solutions (1)
Newton's forward & backward interpolation
Amth250 octave matlab some solutions (2)
The Moore-Spiegel Oscillator
1. newtonsforwardbackwordinterpolation-190305095001.pdf
convulution
22nd BSS meeting poster
Digital signal processing
Solutions for Problems in Fundamentals of Applied Electromagnetics, 8th Globa...
Signals and systems: part i solutions
1st and 2nd Semester M Tech: VLSI Design and Embedded System (Dec-2015; Jan-2...
Perdif Systems of Linear Differential.pdf
Ad

Recently uploaded (20)

PDF
Enhancing Cyber Defense Against Zero-Day Attacks using Ensemble Neural Networks
PPTX
Sustainable Sites - Green Building Construction
PPTX
web development for engineering and engineering
PPTX
MET 305 2019 SCHEME MODULE 2 COMPLETE.pptx
PPTX
UNIT-1 - COAL BASED THERMAL POWER PLANTS
PPTX
FINAL REVIEW FOR COPD DIANOSIS FOR PULMONARY DISEASE.pptx
PPTX
CYBER-CRIMES AND SECURITY A guide to understanding
PPTX
bas. eng. economics group 4 presentation 1.pptx
PDF
Embodied AI: Ushering in the Next Era of Intelligent Systems
PDF
Operating System & Kernel Study Guide-1 - converted.pdf
PDF
Mohammad Mahdi Farshadian CV - Prospective PhD Student 2026
PPTX
Internet of Things (IOT) - A guide to understanding
PPTX
CH1 Production IntroductoryConcepts.pptx
DOCX
ASol_English-Language-Literature-Set-1-27-02-2023-converted.docx
PPT
Project quality management in manufacturing
PDF
PPT on Performance Review to get promotions
PDF
R24 SURVEYING LAB MANUAL for civil enggi
PPTX
additive manufacturing of ss316l using mig welding
PPT
Mechanical Engineering MATERIALS Selection
PPTX
CARTOGRAPHY AND GEOINFORMATION VISUALIZATION chapter1 NPTE (2).pptx
Enhancing Cyber Defense Against Zero-Day Attacks using Ensemble Neural Networks
Sustainable Sites - Green Building Construction
web development for engineering and engineering
MET 305 2019 SCHEME MODULE 2 COMPLETE.pptx
UNIT-1 - COAL BASED THERMAL POWER PLANTS
FINAL REVIEW FOR COPD DIANOSIS FOR PULMONARY DISEASE.pptx
CYBER-CRIMES AND SECURITY A guide to understanding
bas. eng. economics group 4 presentation 1.pptx
Embodied AI: Ushering in the Next Era of Intelligent Systems
Operating System & Kernel Study Guide-1 - converted.pdf
Mohammad Mahdi Farshadian CV - Prospective PhD Student 2026
Internet of Things (IOT) - A guide to understanding
CH1 Production IntroductoryConcepts.pptx
ASol_English-Language-Literature-Set-1-27-02-2023-converted.docx
Project quality management in manufacturing
PPT on Performance Review to get promotions
R24 SURVEYING LAB MANUAL for civil enggi
additive manufacturing of ss316l using mig welding
Mechanical Engineering MATERIALS Selection
CARTOGRAPHY AND GEOINFORMATION VISUALIZATION chapter1 NPTE (2).pptx

graphs plotting in MATLAB