I have written the following code to calculate the power spectrum of a time series of wind speeds.
The u_hov_mat is a 6x12000 matrix and the Sf_mat is 12000x6. I have also made a variable for f_2 which is the same size as u_hov_mat and Sf_mat.
I am not quite sure if what I have written is correct and if the loop is going through each column and row and taking the corresponding values for the Sf_mat calculation. When I run the code it doesn't give me an error but the values I get inside the Sf_mat don't really make sense.
Is my code correct or do I need to change something?. Btw the code won't run because the values for u_hov_mat are inside a .csv file that I am reading in the beginning of the code.
f_2 = reshape(f2',,N2);
Sf_mat(j,i) = (1/(2*pi*N2*f_2(j,i))) * (abs(fft(u_hov_mat(j,i)')))^2;