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 = For an ellipse I realized it by solving the eigenvalue problem for the covariance matrix of the 2D data points. Somehow I need to make these eigenvectors act to rotate all the values that makeup the x1, y1, and z1 matrices, is that right? I am trying to create a 95 Confidence Ellipsoid for a set of data points. 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 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. 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 The following plot is produced by the Matlab code: Matlab Plot Matlab Code g11.0 g24. I want the final plots to be the same however Julia is sorting the eigenvalues in ascending order which is making the plot confusing for my use case. 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. So I am rewriting some code from Matlab into Julia. 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) 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 size of Y must match the size of U or the number of rows of U.RE: step 1. eigplot (mc) creates a plot containing the eigenvalues of the transition matrix of the discrete-time Markov chain mc on the complex plane. 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. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |