MATLAB Answers


Switching a Boundary Condition to Spherical Coordinates

Asked by Hollis Williams on 22 Mar 2019
I am working with a problem on a sphere where I have a formula which gives me the coordinates of a number of nodes distributed at equal distances from each other around a sphere in spherical polar coordinates, so if there are 100 nodes, I can use the formula to get a vector which is 3 x 100, each column corresponding to one of the nodes and then 3 entries for theta, phi, r.
For a boundary condition, I then need to create a 300 x 1 column vector, where you build the column by going to node 1, take cos of its theta component in first row, sin theta in second row, then 0 in the third row. You then go to next node and repeat this and move down the column until it is 300 x 1. What would be the easiest way of doing this?
Let me know if further explanation required.


Sign in to comment.

0 Answers