So we would expect to see the x axis from -10 to 10 and the y-axis from 0 to 5. The function arguments are mixed - the first, phi2, is a free, unassigned variable but the second, A, is range from 0 to 5. Its surprising that nobody had answered that question months ago when it was fresh - maybe it was moved from a different (wrong) section to this forum just later and the thread did not bubble up because of the older date?īTW, what we see in the sheet is a severe bug in Primes 3D plot! So all that would have to be done is create that kind of matrix at equidistant positions and export to Excel.īut as the thread is rather old and the questioner never came back to push the question its likely he is not interested anymore. The surface plot in Excel simply takes a n x m matrix of z-values and shows a surface over an equidistant xy-grid. I'm not sure how you would get a 3D plot in EXCEL but in Mathcad you'd use the function "CreateMesh" to create a (very large) three column array (AKA matrix) that you'd then drop into a 3D plot.Įxcel does not support a decent surface plot as far as I know. Since you desire the elements to be populated by rows, a trick is to simply transpose the result. Therefore, just using reshape by itself will place the elements in the columns. The matrix is created in column-major order. To do this, assign another 3-by-3 matrix to the index value 2 in the third dimension. For example, first define a 3-by-3 matrix as the first page in a 3-D array. You can "vectorize" the equation (means evaluate for each set of values in each vector) and get: reshape transforms a vector into a matrix of a desired size. You can create a multidimensional array by creating a 2-D matrix first, and then extending it. Why? Because A and B are both vectors, so the multiplication signs in the equation are interpreted as "dot products," and you get a single value answer. You can turn A and B into vectors (an undocumented and dangerous practice) by putting an "evaluation" equals sign after the definition but the results aren't what you'd expect: What I have is a function f(x,y) which gives me the results in vector form of course.Īnybody know how I can convert the vector into a matrix or export it to an excel sheet.įirst of all, you don't really have a vector.īecause you define A and B as range variables, your formula computes but if you try to define a vector (Vc), the program throws an error. Meshgrid is limited to two- or three-dimensional Cartesian space.I have to export data for 3d plotting in excel. That is, the statementīecause of this, meshgrid is better suited to problems in two- or three-dimensional Cartesian space, while ndgrid is better suited to multidimensional problems that aren't spatially based. But because each time you are multiplying by a scalar, you can use times. bsxfun(times, reshape(z, 1, 1, ), xy) If z was a 2D matrix itself and you wanted to do a matrix multiplication at each level then you would need to use the links I posted in my comment. The meshgrid function is similar to ndgrid except that the order of the first two input and output arguments is switched. You can just do this because z is vector. Produces three-dimensional arrays used to evaluate functions of three variables and three-dimensional volumetric plots. Multidimensional arrays are an extension of 2-D matrices and use additional subscripts for indexing. Each element is defined by two subscripts, the row index and the column index. In a matrix, the two dimensions are represented by rows and columns. MATLAB Graphics 2-D and 3-D Plots Surfaces. A multidimensional array in MATLAB® is an array with more than two dimensions. so the plot will also have its x-axis and y-axis with scale 3 and 4 but when you will create your vector of 10,000 timestamps, so I am supposing that your matrix will also have some similar dimension. The rows of the output array X are copies of the vector x columns of the output array Y are copies of the vector y. Learn more about surface, 3d plots, plot. Transforms the domain specified by vectors x and y into arrays X and Y, which can be used to evaluate functions of two variables and three-dimensional mesh/surface plots. Generate X and Y matrices for three-dimensional plots Meshgrid (MATLAB Functions) MATLAB Function Reference For a contour plot you actually need either a matrix of z values, or a set (vector) of z-values evaluated on a grid.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |