new file: surface_slice.py
[wrf-fire-matlab.git] / cycling / path_ros.m
blobbb2c62b693294f79eb8886a5476f0e1faf33b44a
1 function [pr,pv,mpv,np] = path_ros(ps)
3 n = length(ps.paths);
4 pr = [];
5 pp = [];
6 pv = [];
7 for i = 2:n
8     p = ps.paths(i).p;
9     for j = 2:length(p)
10 %         d = ps.raw_dist(p(j),p(j-1));
11 %         t = 24*3600*(ps.points(j,3)-ps.points(j-1,3));
12 %         r = d/t;
13 %         pr = [pr;r];
14         pp = [pp;p(j-1) p(j)];
16     end
17 end
18 pp = unique(pp,'rows');
19 n = length(pp);
20 for i = 1:n
22         d = ps.raw_dist(pp(i,1),pp(i,2));
23         t = (ps.points(pp(i,2),3)-ps.points(pp(i,1),3));
24         r = d/t/(24*3600);
25         pr = [pr;r];
26         rv = ros_var(d,t*24);
27         pv = [pv;rv];
29 end
30 figure,histogram(pr)
31 pm = mean(pr);
32 ps = std(pr);
33 tstr = sprintf('ROS along paths \n Mean: %f  STD: %f',pm,ps);
34 title(tstr)
35 xlabel('ROS [m/s]')
36 ylabel('Frequency')
38 msk = isnan(pv);
39 nan_var = sum(msk(:));
40 np = nan_var/n;
41 mpv = mean(pv(~msk));
42 fprintf('Mean of std deviations on paths: %f \n',mpv)
43 fprintf('Percentage of path without variance: %f \n',np*100);
44 figure,histogram(pv(~msk));
45 title('Std deviation of ROS on paths')
48 end %function