blob: 0a20402c257da4e260f9ce70231cdfe301c64e0b (
plain)
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
|
Matlab usage
%!style(html): ../evmik.css
= How to make a simple plot =
Suppose during the measurements we obtain the following data
fir each parameter 'I' we measured 'V' with a particular uncertainty dV.
Our data is represented in the following table.
|| I | V | dV |
| .1 | 1.0 | 0.2 |
| 1.0 | 2.2 | 0.1 |
| 1.8 | 3.2 | 0.2 |
| 3.3 | 3.8 | 0.2 |
| 4.0 | 4.9 | 0.3 |
First of all, we need to transfer it to the Matlab vector variables. Pay
attention to the delimiter **;** between numbers
```
I = [ .1; 1.0; 1.8; 3.3; 4.0 ]
V = [ 1.0; 2.2; 3.2; 3.8; 4.9 ]
dV = [ 0.2; 0.1; 0.2; 0.2; 0.3 ]
```
Now we make a simple plot without error bars to get the basic, text after
**%** is considered as a comment and matlab will disregard it.
```
figure(1) % all plotting output will go to the particular window
plot(I,V)
```
Easy, is not it?
[simple_labeled_plot.png]
But **every plot** must be present with title, proper axes labels and
units. Note **'** for the string specifiers
No our plot is nice and pretty.
[simple_unlabeled_plot.png]
= Plotting with error bars =
Let's open a new window for the plot
``` figure(2)
Now we make plot with error bars assuming that they are the same for up and down parts
``` errorbar(I,V,dV)
Yet again we need proper labeling
```
title('Dependence of voltage on current')
xlabel('Voltage (V)')
ylabel('Current (A)')
```
[errorbar_plot.png]
|