-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgraphPlottingBasics.m
More file actions
38 lines (27 loc) · 1.26 KB
/
graphPlottingBasics.m
File metadata and controls
38 lines (27 loc) · 1.26 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
%Author: Shadril Hassan Shifat (shadril238)
x = [0 1 2 3 4 5]; %time
y = [0 20 28 34 40 42]; %temparature
z = [10 9.5 9.1 8.4 7 5.8]; %weight
plot(x,y,'r*:','linewidth',2); % color- red(r), marker type- *, line style- dotted(:) and linewidth=2
%axis([0 5 0 45]); %axis([xmin xmax ymin ymax]) sets maximum and minimun of x and y axis
xlabel('time in seconds');
%ylabel('temparature in degree');
%title('observation of temparature change with time');
hold on; %command for plotting many graphs in same Figure. hold off ends the hold on.
% figure %command for new Figure window.
% figure(x) %command for selecting Figure x
plot(x,z, 'gh-','linewidth',2);
%xlabel('time in seconds');
ylabel('weight in grams and temparature in degree');
title('observation of weight and temparature change with time');
%text(3,8.4,'This is a note at position (3,8.4)');
hold off;
legend('temparature', 'weight'); %legend
%for more type >> help plot
figure;
subplot(1,3,1); % subplot( m , n , p ) divides the current figure into an m -by- n grid and creates axes in the position specified by p .
plot(x,z, 'gh-','linewidth',2);
subplot(1,3,2);
plot(x,y,'r*:','linewidth',2);
%also in subplot we can use all things used in plot.
%for more type >> help subplot