I'm performing what I believe to be a relatively simple trigonometric calculation on a large (35000×6) matrix, and producing a 35000 entry vector. However, the way Matlab is performing this seems to be to calculating one entry in the final vector, returning the entire vector, and then repeating this process for every calculation. It's been running for twenty minutes and is not close to being done. I assume there is some more efficient way to code this, but I am currently at a loss.
The code in question:
filename = 'matlab drift bb slab.xlsx'data = xlsread(filename)drift1 = zeros(1,35000)drifto = atan((data(1,1)-data(1,4))/(data(1,2)-data(1,5)))for n = (1:35000)drift1(n) = atan((data(n,1)-data(n,4))/(data(n,2)-data(n,5)))-driftoend
Is there a more efficient way to accomplish this?
Best Answer