title: Matlab : Using each element of a column vector to go through a series of calculations (iterations?)
body: <p><code>theta1 = theta(:,1);</code> //This is a column vector of data extracted from an <code>18x30</code> matrix theta1 is 18x1.</p>
  
  <p>Then from here I need to go through each of the individual 18 elements one at a time with the following calculations:</p>
  
  <pre><code>nx =((cos(theta1(1))^2)/(1.5^2) + ((sin(theta1(1))^2)/(1.7^2)))^(-1/2);
  </code></pre>
  
  <p>Here I have selected the first element using "<code>theta1(1)</code>" but ideally I would like to somehow use a for loop so that this calculation can be done for all 18 values of 
  "theta1" that I have and then produce another 18x1 matrix of "nx". I have tried using a for loop but I can't get it to work correctly.</p>
  
  <p>Then after this I want to use each of the 18 elements of "nx" in another calculation to get another variable:</p>
  
  <pre><code>d = (2*pi*(nx-1.5)*0.000018)/0.000000555;
  </code></pre>
  
  <p>So, I am looking for some sort of general for loop or any other suitable method that would allow me to do this type of calculation where I use each element in an array and plug it into a formula and produce another array with the answer of the calcualation.</p>
  
  <p>Thanks in advance.     </p>