Matlab: Difference between revisions
From charlesreid1
(→Basics) |
|||
| Line 4: | Line 4: | ||
See [[Introduction to Matlab]] | See [[Introduction to Matlab]] | ||
{|class="wikitable" | |||
!Name (matrix type) | |||
!Matlab syntax | |||
!Result | |||
|- | |||
|Ones | |||
|<syntaxhighlight lang="matlab"> | |||
>> ones(3,2); | |||
</syntaxhighlight> | |||
|<math> | |||
\left[ | |||
\begin{array}{cc} | |||
1 & 1 \\ | |||
1 & 1 \\ | |||
1 & 1 | |||
\end{array} | |||
\right] | |||
</math> | |||
|- | |||
|Zeros | |||
|<syntaxhighlight lang="matlab"> | |||
>> zeros(3,1); | |||
</syntaxhighlight> | |||
|<math> | |||
\left[ | |||
\begin{array}{cc} | |||
0 \\ | |||
0 \\ | |||
0 | |||
\end{array} | |||
\right] | |||
</math> | |||
|- | |||
|Eye (identity) | |||
|<syntaxhighlight lang="matlab"> | |||
>> eye(3); | |||
</syntaxhighlight> | |||
|<math> | |||
\left[ | |||
\begin{array}{cc} | |||
1 & 0 & 0 \\ | |||
0 & 1 & 0 \\ | |||
0 & 0 & 1 | |||
\end{array} | |||
\right] | |||
</math> | |||
|} | |||
= Input/output = | = Input/output = | ||
Revision as of 04:37, 26 November 2010
Matrices
Basics
| 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}{cc} 1 & 0 & 0 \\ 0 & 1 & 0 \\ 0 & 0 & 1 \end{array} \right] $ |
Input/output
Switches
Functions
Graphics
Examples
Fluid mechanics
Heat transfer
Optimization
Statistics
See also
- Introduction to Matlab (lecture)