ENG1060 Lecture Notes - Lecture 2: Contour Line

61 views3 pages
!"#$$%&'()*$*
Allows&faster,&easier interpretation&of&more&information
Easier&to&characterise&trends
Increasing/decreasing&with&increasing&x
No.&of&max&and&min
plot(x,y)
x&must&be&indep,&y&must&be&dep
Also&has&optional&arguments,&like:
Title,&xlabel,&ylabel
§
Line&colour,&type,&width
§
Marker&colour,&symbol,&size
plot(x,y1,'rs')
hold on
plot(x,y2,'kx')
plot(x,y3,'bo')
'rs'&>>>&red&squares
'kx'&>>>&black&crosses
'bo'&>>>&blue&circles
§
**HAVE&TO&USE&QUOTATION&MARKS&(SINGLE)
§
RGB&triplets&and&linewidth
§
Markersize,&Markerfacecolor,&Markeredgecolor
§
Multiple&plots&can&be&drawn&in&same&figure
plot(x1,y1,x2,y2)
+,%"$-%&(.,&/$%#&0
figure -creates&a&new&figure&window
close all -closing&all&opened&figure&windows
Use&at&the&top&of&script&files
hold on -to&hold&(not&overwrite)&current&figure&window
If&using&two&plot&commands&in&sequence,&first&will&be&overridden&unless&
you&use&this
Also&hold&off
grid on -turn&on&grid&axes
Also&grid&off
legend -turn&on&legend&with&a&key
Use&when&plotting&multiple&curves&in&same&figure
subplot(rows, columns, panel no./index) -multiple&plot&
windows&in&a&figure&window&-separated&frm&each&other&in&separate&boxes
subplot(3, 1, 1)
plot(x,y1,'b')
xlabel('x')
ylabel('y1')
subplot(3, 1, 2)
xlabel('x')
ylabel('y2')
axis([ xmin xmax ymin ymax]) -setting&range&of&x&and&y&axes
12(3"#$$%&'(.,&/$%#&0(4*5*(6#",7809
plot3(x,y,z) -3D&line&plot
mesh(x,y,z) -mesh&plot
surf(x,y,z) -surface&plot
contour(z,number_of_lines) -contour&plot
Helix:&
t = linspace(0, 10*pi, 200);
plot3(sin(t), cos(t), t);
xlabel('sin(t)');
ylabel('cos(t)');
zlabel('t');
title('An example helix');
grid on;
3D&peak:
[x,y] = meshgrid(-2:0:2:2);
z = exp(-.^2 -y.^2);
mesh(x,y,z);
xlabel('x');
ylabel('y');
zlabel('z');
title('An example peak');
grid on;
If&surface of&peak,&same&thing&except
surf(x,y,z,50);
title('An example surface of peak');
If&viewing&contours of&peak,&same&thing&except
contour(x,y,z,50);
title('Example contours of a peak');
Week$2:$Plotting
Tuesday,& 1&August& 2017
11:09
Unlock document

This preview shows page 1 of the document.
Unlock all 3 pages and 3 million more documents.

Already have an account? Log in

Document Summary

No. of max and min plot(x,y) x must be indep, y must be dep. Marker colour, symbol, size plot(x,y1,"rs") hold on plot(x,y2,"kx") plot(x,y3,"bo") Multiple plots can be drawn in same figure plot(x1,y1,x2,y2) Built-in functions figure - creates a new figure window close all - closing all opened figure windows. Use at the top of script files hold on - to hold (not overwrite) current figure window. If using two plot commands in sequence, first will be overridden unless you use this. Also hold off grid on - turn on grid axes. Also grid off legend - turn on legend with a key legend - turn on legend with a key. 3d plotting functions (aka volumes) plot3(x,y,z) - 3d line plot mesh(x,y,z) - mesh plot surf(x,y,z) - surface plot contour(z,number_of_lines) - contour plot. Helix: t = linspace(0, 10*pi, 200); plot3(sin(t), cos(t), t); xlabel("sin(t)"); ylabel("cos(t)"); zlabel("t"); title("an example helix"); grid on;

Get access

Grade+20% off
$8 USD/m$10 USD/m
Billed $96 USD annually
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
40 Verified Answers
Class+
$8 USD/m
Billed $96 USD annually
Class+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
30 Verified Answers

Related Documents