Lesson 3 - 2D plot, Labels,colour, Subplot, Bar, histo , polar, semilog, loglog, 3D Mesh Surfaces
2.3 هزار بار بازدید -
11 ساعت پیش
-
Lesson 3 Plots Using Octave
Lesson 3 Plots Using Octave / Metlab
2D: (X,y) plot, Graph Labels, Plot - colour, marker, style, Subplot() function, Bar, histogram , polar graphs, Semilogx(), semilogy(), loglog(),3D Mesh Surfaces
X,y) plot
- 2d Graph – Plot statement
- Need to define the x-axis AND y-axis
Graph Labels
Grid on (add grid lines) Title (‘text’)
xlabel (‘x-axis’)
ylabel (‘y-label’) legend ( )
Plot - colour, marker, style
Colour: b – blue g – green k – black r - red
Marker: + vertical cross * star o circle x diagonal cross
Line Style: - solid line . dotted ^ impulses L Steps
.+r would plot a dotted, cross, red line
Example 1:
X = [0:0.1:10]
Y = sin(x)
plot (x,y)
title ( ‘y=sin(x)’ )
Grid on
Example 2:
Plot a straight line [x1,y1] = [0 6] [x2,y2] = [2 6]
Plot on octave
Plot ([0 2], [6 6])
Example 3: Multiple plot
x = 0:0.1:10
y1 = sin(x)
y2 = cos(x)
plot (x,y1, ‘.+r’, x,y2, ‘-*b’)
title (‘y1 and y2’)
grid on
Subplot() function
You can create subplots within a single plot windows. Subplot (Row, Column, position)
Example 4:
sub plot
x = 0:0.1:10
y1 = sin(x)
y2 = cos(x)
y3 = tan(x)
Subplot(2,2,1), plot(x,y1)
Subplot(2,2,2), plot(x,y2)
Subplot(2,2,3), plot(x,y3)
Bar, histogram , polar graphs
Example 5: Bar Charts
X = [2 4 6 8 10]
Y = [1.2 2.5 3.0 1.6 1.1]
Bar (x,y)
Example 6: Barh Charts
X = [2 4 6 8 10]
Y = [1.2 2.5 3.0 1.6 1.1]
Barh (x,y)
Example 7: Histogram Charts
Semilogx(), semilogy(), loglog()
Example 9: semilogx – plot with logarithmically spaced x-axes
Y= [0:1:5]
X=exp(-y/1)
semilogx(x,y)
grid on
Example 10: semilogy – plot with logarithmically spaced y-axes
X = [0:1:5]
Y =exp(-x/1)
Semilogy(x,y)
Grid on
Example 11: subplot loglog
graph1
X1 = [0:1:5]
Y1 =exp(-x/1)
subplot(2,1,1)
Semilogy(x,y)
Grid on
graph2
x2 = [0:1:5]
y2 = exp(x2/2)
subplot (2,1,2)
loglog(x2,y2)
grid on
Mesh Surfaces
*Mesh() – octave plots a wireframe mesh using *rectangle mesh x,y,z)
*Meshgrid() – is used to produce input for a 2D or 3D function that will be plotted
Linspace: Create a row vector of N elements evenly spaced between x1 and x2
*Surf() generates a 3D surface plot whereby a wire mesh surface is filled up with small tiles
*Meshc: generates a 3D rectangular mesh, including contour plot.
Example 1: Mesh()
x=y=linspace (-1,1,15)
[x,y] = meshgrid(x,y)
z = x^2 + y^2
mesh (x,y,z)
xlabel(‘x-axis’), y-label(‘y-axis’), zlabel(‘z-axis’)
Example 2: Meshgrid()
x=y=linspace(-1,1,5)
x=y=meshgrid(x,y)
z = (x^2 – y^2)
mesh (x,y,z)
Example 3: Surf
x=y=linspace(-1,1,5)
x=y=meshgrid(x,y)
z = (x^2 – y^2)
surf (x,y,z)
Example 4: meshc
x=y=linspace(-1,1,5)
x=y=meshgrid(x,y)
z = (x^2 – y^2)
meshc (x,y,z)
--------------------------------------------------------------------------------------------------
Access Ready Information for you:
Octave, Coco Simulation, DWSIM Simulation
Octave:
1. Download Octave - • How To Download and Install Octave GN...
2. Lesson 1.1 - Octave Tutorial / Matlab Introduction to Octave • Lesson 1.1 - Octave Tutorial / Matlab...
3. Lesson 1.2 - OCTAVE TUTORIAL (MATLAB): HELP FUNCTION, DISP FUNCTION, INPUT FUNCTION. link: • LESSON 1.2 – OCTAVE TUTORIAL (MATLAB)...
4. LESSON 2.1 – OCTAVE TUTORIAL (MATLAB): COMPLEX NUMBERS, TRIGONOMETRY, SQUARE ROOT • LESSON 2.1 –OCTAVE TUTORIAL (MATLAB):...
5. LESSON 2.2 OCTAVE TUTORIAL (MATLAB): ROW VECTORS, ARRAYS, ADDITION OF VECTORS MATRIX • LESSON 2.2 OCTAVE TUTORIAL (MATLAB): ...
6. LESSON 2.3 OCTAVE TUTORIAL (MATLAB): MATRIX - Solving Linear equations using Matrix • LESSON 2.3 OCTAVE TUTORIAL (MATLAB): ...
7. Finding Roots if Linear three linear equations using Matrix- Octave • Finding Roots if Linear three linear ...
8. Transfer Function - Process Control Example 1 using Octave • Transfer Function - Process Control E...
9. Transfer Function - Process Control Example 2 using Octave • Transfer Function - Process Control E...
10. Transfer Function - Process Control Example 3 using Octave • Transfer Function - Process Control E...
11. Transfer Function -Process Control Example 4 using Octave. Solve Series, Parallel, Negative Feedback • Transfer Function -Process Control Ex...
12. Step By Step Guide. Transfer Function -Process Control E.g 5 using Octave. Series,Parallel,Feedback • Step By Step Guide. Transfer Function...
13. [z,p,k] = tf2zp on Octave. Transfer Function - Process Control Example 6. Step by Step Guide • [z,p,k] = tf2zp on Octave. Transfer F...
14. Lesson 3 - 2D plot, Labels,colour, Subplot, Bar, histo , polar, semilog, loglog, 3D Mesh Surfaces • Lesson 3 - 2D plot, Labels,colour, Su...
15. Example: Control Statments, For Loop, While Loop, If , Else, ElseIf Statement. Lesson 4.1 • Example: Control Statments, For Loop,...
DWSIM Simulation
1. • How to Download and Install DWSIM V6....
--------------------------------------------------------------------------------------------
Email any example you'd like for me to solve something similar of
[email protected]
Or comment your questions Thanks for watching next tricky problems / lessons that will broaden your knowledge are coming
--------------------------------------------------------------------------------------------------------------------------
11 ساعت پیش
در تاریخ 1403/07/09 منتشر شده
است.
2,399
بـار بازدید شده