Plotting the boundaries of an object

2 Ansichten (letzte 30 Tage)
Said Rahal
Said Rahal am 12 Jul. 2012
I read that the syntax f plotting a boundary of an object is the following:
plot (t(:,2),t(:,1),'g','Linewidth',2)
where t is a boundary. I ran it in MATLAB and it worked. However I did not know why we input the first two arguments in that manner.
Can any share his knowledge about that?
Thanks for your time and attention

Akzeptierte Antwort

Walter Roberson
Walter Roberson am 12 Jul. 2012
plot(X1,Y1,...,Xn,Yn) plots each vector Yn versus vector Xn on the same axes.
Accessing Multiple Elements
For the 4-by-4 matrix A shown below, it is possible to compute the sum of the elements in the fourth column of A by typing
A = magic(4);
A(1,4) + A(2,4) + A(3,4) + A(4,4)
You can reduce the size of this expression using the colon operator. Subscript expressions involving colons refer to portions of a matrix. The expression
A(1:m, n)
refers to the elements in rows 1 through m of column n of matrix A. Using this notation, you can compute the sum of the fourth column of A more succinctly:
sum(A(1:4, 4))
Thus, the syntax you are using is to extract columns from your array and use them as the X and Y for plotting purposes.
  2 Kommentare
Said Rahal
Said Rahal am 12 Jul. 2012
Thank you Walter. So Can I conclude that by definition the second column of the matrix that defines a boundary is X and the first column is Y.
Walter Roberson
Walter Roberson am 12 Jul. 2012
In that matrix, yes. Not generally in matrices, though.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by