I have a large amount of raw data which I need to analyse.
The data describes the wind direction, speed and the height at which the measurement was taken.
Basically, if the wind direction is between 315 and 360 degrees. I would like to graph the natural log of the speed against the natural log of the height. The slope of this line is the shear exponent.
Each row of the excel spreadsheet contains the relevant information necessary to generate a graph and calculate the slope. I would to find the mean slope of all rows.
The code below is what I've written so far. However, I think
line = polyfit(x,y,1);m = line(1);
Is only finding the slope of the first row.
tic; kane = 'Kane_Data_Splice.xlsx'; Height = [19 44 69 90 148]; Speed = [xlsread(kane,'BA:BA') xlsread(kane,'AS:AS') xlsread(kane,'AK:AK') xlsread(kane,'AC:AC') xlsread(kane,'U:U')]; Direction = xlsread(kane,'T:T'); n = numel(Direction); for i = 1:n if (315 < Direction(i)) && (Direction(i) < 360) p = repmat(log(Height),n,1); q = log(Speed); x = p(i,:); y = q(i,:); line = polyfit(x,y,1); m = line(1); end end m ExecutionTime = toc
Thanks for your help!
Best Answer