This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
gibson:teaching:spring-2016:math445:lecture:scripts [2016/02/01 19:10] gibson [logarithmic plots] |
gibson:teaching:spring-2016:math445:lecture:scripts [2016/02/03 13:54] (current) gibson [Logarithmic plots] |
||
---|---|---|---|
Line 4: | Line 4: | ||
<code> | <code> | ||
Matlab scripting | Matlab scripting | ||
- | plot, semilogy, semilogx, loglog | + | linestyles and plot modifiers: |
- | xlabel, ylabel, title, legend, axis, grid, clf, | + | xlabel, ylabel, title, legend, axis, grid, clf, |
- | linestyles | + | |
load, save | load, save | ||
- | what, pwd | + | plot, semilogy, semilogx, loglog |
+ | what, who, pwd, ls | ||
</code> | </code> | ||
Line 51: | Line 51: | ||
{{ :gibson:teaching:spring-2016:math445:sincos.png?direct&400 |}} | {{ :gibson:teaching:spring-2016:math445:sincos.png?direct&400 |}} | ||
- | ===== Markers and line styles ===== | + | ===== Line styles and markers ===== |
The above plotting script used the matlab **linestyle** codes '' 'b-' '' and '' 'r-' '' to generate blue and red curves for $\cos x$ and $\sin x$. Matlab's **help** function provides a pretty good description of how line and marker style codes work. | The above plotting script used the matlab **linestyle** codes '' 'b-' '' and '' 'r-' '' to generate blue and red curves for $\cos x$ and $\sin x$. Matlab's **help** function provides a pretty good description of how line and marker style codes work. | ||
Line 106: | Line 106: | ||
</code> | </code> | ||
- | ===== logarithmic plots ===== | ||
- | |||
- | Logarithmic plots are useful when the data you're plotting varies over many orders of magnitude. Logarithmic plots can also highlight certain functional relationships | ||
- | |||
- | ^ plot command ^ functional relationship ^ | ||
- | | **plot(x,y)** ^ $y = mx + b$ ^ | ||
- | | **semilogy(x,y)** | $y = c \; 10^{mx}$ ^ | ||
- | | **semilogx(x,y)** | $\log y = mx + b$ ^ | ||
- | | **loglog(x,y)** | $y = c x^m$ ^ | ||