Matlab: Difference between revisions
From charlesreid1
(→Basics) |
(→Basics) |
||
| Line 4: | Line 4: | ||
See [[Introduction to Matlab]] | See [[Introduction to Matlab]] | ||
== Special matrices/vectors == | |||
{|class="wikitable" | {|class="wikitable" | ||
| Line 48: | Line 50: | ||
0 & 1 & 0 \\ | 0 & 1 & 0 \\ | ||
0 & 0 & 1 | 0 & 0 & 1 | ||
\end{array} | |||
\right] | |||
</math> | |||
|- | |||
|Meshgrid | |||
|<syntaxhighlight lang="matlab"> | |||
>> [x,y] = meshgrid(1:4,1:4) | |||
</syntaxhighlight> | |||
|<math> | |||
x = \left[ | |||
\begin{array}{cccc} | |||
1& 2& 3& 4\\ | |||
1& 2& 3& 4\\ | |||
1& 2& 3& 4\\ | |||
1& 2& 3& 4 | |||
\end{array} | |||
\right] | |||
</math> | |||
<math> | |||
y = \left[ | |||
\begin{array}{cccc} | |||
1& 1& 1& 1\\ | |||
2& 2& 2& 2\\ | |||
3& 3& 3& 3\\ | |||
4& 4& 4& 4 | |||
\end{array} | \end{array} | ||
\right] | \right] | ||
</math> | </math> | ||
|} | |} | ||
== Matrix/vector operators == | |||
== | |||
= Input/output = | = Input/output = | ||
Revision as of 04:43, 26 November 2010
Matrices
Basics
Special matrices/vectors
| Name (matrix type) | Matlab syntax | Result |
|---|---|---|
| Ones | >> ones(3,2);
|
$ \left[ \begin{array}{cc} 1 & 1 \\ 1 & 1 \\ 1 & 1 \end{array} \right] $ |
| Zeros | >> zeros(3,1);
|
$ \left[ \begin{array}{cc} 0 \\ 0 \\ 0 \end{array} \right] $ |
| Eye (identity) | >> eye(3);
|
$ \left[ \begin{array}{ccc} 1 & 0 & 0 \\ 0 & 1 & 0 \\ 0 & 0 & 1 \end{array} \right] $ |
| Meshgrid | >> [x,y] = meshgrid(1:4,1:4)
|
$ x = \left[ \begin{array}{cccc} 1& 2& 3& 4\\ 1& 2& 3& 4\\ 1& 2& 3& 4\\ 1& 2& 3& 4 \end{array} \right] $
$ y = \left[ \begin{array}{cccc} 1& 1& 1& 1\\ 2& 2& 2& 2\\ 3& 3& 3& 3\\ 4& 4& 4& 4 \end{array} \right] $ |
Matrix/vector operators
==
Input/output
Switches
Functions
Graphics
Examples
Fluid mechanics
Heat transfer
Optimization
Statistics
See also
- Introduction to Matlab (lecture)