theta1 = theta(:,1); //This is a column vector of data extracted from an 18x30 matrix theta1 is 18×1.
Then from here I need to go through each of the individual 18 elements one at a time with the following calculations:
nx =((cos(theta1(1))^2)/(1.5^2) + ((sin(theta1(1))^2)/(1.7^2)))^(-1/2);
Here I have selected the first element using “theta1(1)” 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 18×1 matrix of “nx”. I have tried using a for loop but I can’t get it to work correctly.
Then after this I want to use each of the 18 elements of “nx” in another calculation to get another variable:
d = (2*pi*(nx-1.5)*0.000018)/0.000000555;
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.
Thanks in advance.
Try using