This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
gibson:teaching:spring-2018:math445:lecture:vectors [2018/01/26 06:51] gibson [Constructing vectors with linspace] |
gibson:teaching:spring-2018:math445:lecture:vectors [2018/01/26 06:53] gibson [Constructing vectors with linspace] |
||
---|---|---|---|
Line 158: | Line 158: | ||
<code matlab> | <code matlab> | ||
- | x = linspace(0, 2*pi, 100); % construct a vector x of 100 gridpoints evenly spaced between 0 and 2pi | + | >> x = linspace(0, 2*pi, 100); % construct a vector x of 100 gridpoints evenly spaced between 0 and 2pi |
- | f = sin(x); % construct a vector f of sin evaluated at the gridpoints x | + | >> f = sin(x); % construct a vector f of sin evaluated at the gridpoints x |
- | whos x f | + | >> whos x f |
Name Size Bytes Class Attributes | Name Size Bytes Class Attributes | ||
Line 174: | Line 174: | ||
<code matlab> | <code matlab> | ||
- | >> | + | >> x = linspace(0, 2*pi, 5) |
- | x = linspace(0, 2*pi, 5) | + | |
x = | x = | ||
+ | 0 1.5708 3.1416 4.7124 6.2832 | ||
- | 0 1.5708 3.1416 4.7124 6.2832 | + | >> f = sin(x) |
- | + | ||
- | f = sin(x) | + | |
f = | f = | ||
- | + | 0 1.0000 0.0000 -1.0000 -0.0000 | |
- | 0 1.0000 0.0000 -1.0000 -0.0000 | + | |
</code> | </code> | ||