Here, I assume three successive rotations performed in the order: about the x-axis first, then the y-axis, and then the z-axis. Psi1 is a rotation about the x-axis, theta1 is a rotation about the y-axis, and phi1 is a rotation about the z axis. In the above I assumed a rotation matrix that rotates a point around an axis (as apposed to a transformation matrix that transforms the coordinates of a stationary point as the axes of the coordinate system is rotated while fixed at the origin). Phi1 = atan2d(R(2,1)/cos(theta1),R(1,1)/cos(theta1)) %rotation around z-axis in degreesĭirection = %rotate the surface plot psi1 degrees around its x-axisĭirection = %rotate the surface plot theta1 degrees around its y-axisĭirection = %rotate the surface plot phi1 degrees around its z-axis Psi1 = atan2d(R(3,2)/cos(theta1),R(3,3)/cos(theta1)) %rotation around x-axis in degrees Theta1 = -asind(R(3,1)) %rotation around y-axis in degrees the unique identifier, of the surfaceĪxis equal %# Make tick mark increments on all axes equal Hsurf = surf(x1,y1,z1) %# capture the handle, i.e. Was something like this what you were thinking? (If no, could you educate me on what I have done wrong and/or how you were thinking?) Pmatrix = Somehow I need to make these eigenvectors act to rotate all the values that makeup the x1, y1, and z1 matrices, is that right? What I'm wrestling with now is how to bring the eigenvectors into the picture (or into the code). RE the code I am trying to build: OK, so updating my code to something like this (per your help): =sphere Principal components analysis (PCA) is widely used in an enormous variety of settings to characterize the variability in a set of measurements. However, the values I see for x, y, z when using this code does not match the values I see for when I used =sphere. Eigenvectors, Eigenvalues, and Principal Components Analysis (PCA) In this laboratory, we will analyze a set of data to find the principal components along which the data is scattered. R = ones(size(th)) % should be your R(theta,phi) surface in general As close as I can tell, it is running a code somewhat similar to this code, as shown here: N = 21 RE meshgrid: I understand how this function works now after viewing a few references, and how it is used by the surf function.Īs part of my exploration of understanding, I wondered how exactly the sphere function was populating its x, y, z matrices. I look forward to any comments you have for me. I am also totally disregarding the fact that the a, b, c terms are squared.so I'm not sure what kind of error I have introduced by simply multiplying my x, y, z coordinates by the "un-squared" eigenvalues. However, how do I know which eigenvalues correspond to a, b, c? (as far as I know matlab's default is to list the eigenvalues in order from smallest to largest) An eigenvalue and eigenvector of a square matrix A are, respectively, a scalar and a nonzero vector that satisfy. I need my x, y, z coordinates to be stretched so I need my a 2, b 2, and c 2 values to be less than 1? To me, it makes more sense to multiply my x, y, z coordinates by my eigenvalues.So I'm thinking it would be correct for me to write something like?: =sphere Therefore the sphere gets either stretched or squeezed depending on the values of a, b, c, in the x, y, z-directions, respectively. When a=b=c=1 we recover the equation of a sphere centered at the origin. The equation of a non-rotated ellipsoid centered at the origin is: Is it paired with the values in the y- and z-matrix that are located in row 3, col 4? (Thus creating a single x-y-z coordinate point) This next question is to understand how these three matrices are used to generate the surface of the sphere: looking at a value in the x-matrix, say row 3, col 4. The default size of 'n' is 20, therefore if I just use the function 'sphere' I am given three matrices that are 21-by-21 in size. From mathworks help, I see that, " = sphere(.) returns the coordinates of the n-by-n sphere in three matrices that are (n+1)-by-(n+1) in size." The plot(x, y) command in Matlab plots two vectors x and y against each other, with x representing the values on the x-axis and y representing the corresponding. The size of Y must match the size of U or the number of rows of U.RE: step 1. My problem is the last line, I get the following error : Error using quiver (line 44) % getting the eigenvalues and the eigenwert I'm trying to plot a the eigenvectors of a 2D Dataset, for that I'm trying to use the quiver function in Matlab, here's what I've done so far : % generating 2D data
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |