# Formula to calculate CV2

Hello,

Could you please give me the exactly formula used to calculate CV2_Sonic_m.val
from u,v,w sonic anemometer measurements.

Hi Rabah,

if you look at items 2 and 3 on github.com/NREL/TITANIC.

Good luck,

Andy

Hi Andy,

I find this part of matlab code where cv2 is calculated

for li = 1:numel(L)
uplagged = [u_p NaN*ones(1,L(li)-1)];
Tplagged = [T_p NaNones(1,L(li)-1)];
u_p_zero = [NaN
ones(1,L(li)-1) u_p];
T_p_zero = [NaN*ones(1,L(li)-1) T_p];
DVV(L(li)) = nanmean((uplagged - u_p_zero).^2);
DTT(L(li)) = nanmean((Tplagged - T_p_zero).^2);
end

cv2 is the structure functions of velocity, i think it suppose include all the 3 components of air mouvement.
but looking at the code it seems cv2 is calculated only using the zonal component (u),Am i wrong ?
Also i need to know how U_ref is calculated, i didn’t find any thing in all matlab codes.

Thank you

Rabah

The code for the structure function is in SubDissipationRateStructureFunction.m. This function is called from FirstLook as follows:

```[epsilon_SF,lags,cv2,cv2m,DVV,cT2,cT2m,DTT] = ... SubDissipationRateStructureFunction(SonicAdvectionSpeed,... tower.daqfreq,u_p,T_p) ```

You should note that u_p is the fluctuating component of the prevailing wind, and SonicAdvectionSpeed is the mean of that wind speed. It’s not the zonal or meridional wind speed.

So, if the structure function is supposed to be from the fluctuations of the wind speed I think I’m doing that.