| New Reply |
Meaning of : in the parentheses |
Share Thread | Thread Tools |
| Dec7-12, 04:37 AM | #1 |
|
|
Meaning of : in the parentheses
Hi guys, I am currently doing a Matlab program for partial pivoting. I looked at my friend's example:
Code:
% Partial Pivoting for i=1:n-1 for j = i+1:n if (a(j,i)) > (a(i,i)) u=a(i,:); a(i,:)=a(j,:); a(j,:)=u; v=b(i,1); b(i,1)=b(j,1); b(j,1)=v; end end end |
| Dec7-12, 05:35 AM | #2 |
|
Recognitions:
|
The colon stands for a whole line in the matrix. Observe:
Code:
octave:117> m=magic(4)
m =
16 2 3 13
5 11 10 8
9 7 6 12
4 14 15 1
octave:118> m(2,:)
ans =
5 11 10 8
octave:119> m(:,2)
ans =
2
11
7
14
... so m(2,:) says to take the entire second row while the m(:,2) says take the second column. http://volga.eng.yale.edu/sohrab/mat...colon_operator (Matlab works the same way...) |
| Dec7-12, 06:23 AM | #3 |
|
|
Thanks bro.
|
| Dec7-12, 07:26 AM | #4 |
|
Recognitions:
|
Meaning of : in the parentheses
No worries ;)
Generally, you can try out the confusing operations you see on some random matrix and see what happens ... the magic-square function is very useful for this. |
| New Reply |
| Thread Tools | |
Similar Threads for: Meaning of : in the parentheses
|
||||
| Thread | Forum | Replies | ||
| Parentheses around mismatched size fractions in LaTeX | Math & Science Software | 2 | ||
| Order of Parentheses in a Sum | Calculus & Beyond Homework | 6 | ||
| Sigma notation and parentheses question | Calculus & Beyond Homework | 7 | ||
| When decimals and/or fractions are only within the parentheses in a linear equation | Precalculus Mathematics Homework | 4 | ||
| Parentheses ... or brackets (US/UK terminology question) | Precalculus Mathematics Homework | 4 | ||