Script to computer exercises 4 |
01 function [xx,x,z] = splitload(x0,tz) 02 % SPLITLOAD Split a switching load (e.g. switchingload.mat) 03 % [xx,x,z] = splitload(x0,tz) 04 05 j0 = min(find(x0(:,1)>=tz(1,1))); 06 j = max(find(x0(:,1)<tz(end,1))); 07 x = x0(j0:j,:); 08 z = 3*ones(length(x),1); 09 10 j0 = 1; 11 for i = 1:length(tz)-1 12 j1 = max(find(x(:,1)<tz(i+1,1))); 13 z(j0:j1) = tz(i,2)*ones(j1-j0+1,1) ; 14 j0 = j1+1; 15 end 16 for k = min(z):max(z) 17 xx{k} = x(z==k,:); 18 end 19 20
Comments or corrections to the WAFO group