constructing hemisphere in MATLAB -


I had to construct a hemisphere in MATLAB, so I did this:

  = 5; N = 2 ^ K-1; Theta = P * (- N: 2: n) / N; PHI = (P / 2) * (0: 2: n) '/ n; X = cos (pi) * cos (theta); Y = Cos (P) * Sin (Theta); Z = sin (PI) * ones (size (theta)); Surf (x, y, z);   

Enter image details here

code Was not written by me, so I want to understand it when I replaced '<'> phi = (pi / 2) * (0: 2: n) in '/ n;
I get the following error:
operator *: non-conformant arguments (option1x16, op2 is 1x32)

please explain this That's why it is necessary .... Besides, I wanted to write a simple code to underline the hemisphere. For some less command / method, I can use any idea in matlab ....

' --Sign transfer is if you multiply a 16-by-1 array by 1-by -32, you end up with a 16-by-32 array, where the element (i, j) ith- Elements of the first array multiply with the tithic element of the second array. If you forget to move, then you are trying the matrix - multiply 1-by-16 array with 1-by-32 array, which is undefined in linear algebra. Using Linear Algebas in this way, in a way, there is a grid of numbers in matlab. For example

  [theta, phi] = ndgrid (pi * (- N: 2: n) / n, (p / 2) * (0: 2: n) / n) ; X = cos (pi). * Cos (theta); ...   

Note that I have elemental properties: . * is used, because I'm not doing linear algebra here.

For your second question: If the code you posted is too long, it is easy to put it in a function, so that you can create a plot through a one-line function call.

Comments

Popular posts from this blog

php - PDO bindParam() fatal error -

logging - How can I log both the Request.InputStream and Response.OutputStream traffic in my ASP.NET MVC3 Application for specific Actions? -

java - Why my included JSP file won't get processed correctly? -