matlab:introduction_to_matlab
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionLast revisionBoth sides next revision | ||
matlab:introduction_to_matlab [2019/04/26 21:58] – [Matrix operations] mithat | matlab:introduction_to_matlab [2021/12/07 19:10] – [With "main" function] mithat | ||
---|---|---|---|
Line 6: | Line 6: | ||
===== What is it? ===== | ===== What is it? ===== | ||
+ | * A // | ||
* A freaking huge, feature filled graphing calculator | * A freaking huge, feature filled graphing calculator | ||
* Comprehensive | * Comprehensive | ||
Line 105: | Line 106: | ||
<code matlab> | <code matlab> | ||
% separate matrix rows with ';' | % separate matrix rows with ';' | ||
+ | |||
a = [1 2 3; 4 5 6; 7 8 9]; | a = [1 2 3; 4 5 6; 7 8 9]; | ||
- | c = [9 8 7; 6 5 4; 3 2 1]; | + | b = [9 8 7; 6 5 4; 3 2 1]; |
</ | </ | ||
===== Matrix operations ===== | ===== Matrix operations ===== | ||
- | Assume '' | ||
<code matlab> | <code matlab> | ||
- | r = num * a; % scalar multiplication | + | r = 1.25 * a; % scalar multiplication |
r = a * b; % matrix multiplication | r = a * b; % matrix multiplication | ||
r = a .* b; % elementwise multiplication | r = a .* b; % elementwise multiplication | ||
Line 314: | Line 315: | ||
===== With " | ===== With " | ||
* Minimum syntax: | * Minimum syntax: | ||
- | <file matlab | + | <file matlab |
- | function main | + | function main() |
area1 = traparea(1, 2, 3); | area1 = traparea(1, 2, 3); | ||
disp(area1); | disp(area1); |
matlab/introduction_to_matlab.txt · Last modified: 2021/12/07 19:11 by mithat