edit specth edit sd [t,x]=specth('sd',0,10,50,25,250,1,1,123); plot(t,x) [t,x]=specth('sd',0,10,50,50,500,1,1,123); plot(t,x) hist(x) [t,x]=specth('sd',0,10,50,50,500,1,100,123); plot(t,x) plot(t,x(1:10,:)) plot(t,x(1:5,:)) whos Name Size Bytes Class Attributes t 1x501 4008 double x 100x501 400800 double xi = 0:.1:4; for i = 1:length(xi) pf(i) = sum( max(x,2) > xi(i))/100; end {??? In an assignment A(I) = B, the number of elements in B and I must be the same. } temp = max(x,2); whos Name Size Bytes Class Attributes i 1x1 8 double pf 0x0 0 double t 1x501 4008 double temp 100x501 400800 double x 100x501 400800 double xi 1x41 328 double help max MAX Largest component. For vectors, MAX(X) is the largest element in X. For matrices, MAX(X) is a row vector containing the maximum element from each column. For N-D arrays, MAX(X) operates along the first non-singleton dimension. [Y,I] = MAX(X) returns the indices of the maximum values in vector I. If the values along the first non-singleton dimension contain more than one maximal element, the index of the first one is returned. MAX(X,Y) returns an array the same size as X and Y with the largest elements taken from X or Y. Either one can be a scalar. [Y,I] = MAX(X,[],DIM) operates along the dimension DIM. When X is complex, the maximum is computed using the magnitude MAX(ABS(X)). In the case of equal magnitude elements, then the phase angle MAX(ANGLE(X)) is used. NaN's are ignored when computing the maximum. When all elements in X are NaN's, then the first one is returned as the maximum. Example: If X = [2 8 4 then max(X,[],1) is [7 8 9], 7 3 9] max(X,[],2) is [8 and max(X,5) is [5 8 5 9], 7 5 9]. See also min, median, mean, sort. Overloaded methods: timeseries/max ordinal/max Reference page in Help browser doc max for i = 1:length(xi) pf(i) = sum( max(x,[],2) > xi(i))/100; end plot(xi,pf) figure plot(t,x(1:5,:)) plot(t,x(1:100,:)) pf2 = 1-normcdf(xi); hold Current plot held plot(xi,pf2,'r') for i = 1:length(xi) pf3(i) = sum( max(x(:1:250),[],2) > xi(i))/100; ??? pf3(i) = sum( max(x(:1:250),[],2) > xi(i))/100; | {Error: Unexpected MATLAB expression. } for i = 1:length(xi) pf3(i) = sum( max(x(:,1:250),[],2) > xi(i))/100; end plot(xi,pf3,'g') for i = 1:length(xi) pf4(i) = sum( max(x(:,1:125),[],2) > xi(i))/100; end for i = 1:length(xi) pf5(i) = sum( max(x(:,1:50),[],2) > xi(i))/100; end for i = 1:length(xi) pf6(i) = sum( max(x(:,1:5),[],2) > xi(i))/100; end plot(xi,pf4,'k') plot(xi,pf5,'c') plot(xi,pf6,'m') for i = 1:length(xi) pf7(i) = sum( max(x(:,1:1),[],2) > xi(i))/100; end plot(xi,pf7,'y') xdot = x(:,1:500)-x(:,2:501); for i = 1:500 for j = 1:100 plot(x(i,j),xdot(i,j),'.'); end end i i = 69 j j = 74 for i = 1:50 for j = 1:100 plot(x(i,j),xdot(i,j),'.'); end end figure hold Current plot held for i = 1:50 for j = 1:100 plot(x(i,j),xdot(i,j),'.'); end end axis equal mean(std(xdot)) ans = 0.2313 xx = reshape(x,500*100,1); {??? Error using ==> reshape To RESHAPE the number of elements must not change. } xx = reshape(x(:,1:500),500*100,1); xxdot = reshape(xdot,500*100,1); plot(xx,xxdot,'.'); corrcoef(xx,xxdot) ans = 1.0000 0.1204 0.1204 1.0000 plot(t,x(1,:)) xx = x(1,:); plot(t,xx) vv = xx; plot(t,vv) xx = vv.^3; hold Current plot held plot(t,xx,'g'); [t,x]=specth('sd',0,10,50,500,5000,1,1,123); [t,v]=specth('sd',0,10,50,500,5000,1,1,123); plot(t,v) [t,v]=specth('sd',0,10,500,500,5000,1,1,123); plot(t,v) x = v.^3; hold Current plot held plot(t,v,'g') plot(t,v) plot(t,x,'g') edit process_correlation_sample.m [tau,rhov] = process_correlation_sample(t,v,100); corr_length = 0.7000 figure plot(tau,rhov) [tau,rhov] = process_correlation_sample(t,v,10); corr_length = 0.7000 plot(tau,rhov) figure plot(tau,rhov) [tau,rhox] = process_correlation_sample(t,x,10); corr_length = 2.6000 hold Current plot held plot(tau,rhox,'g') [tau,rhov] = process_correlation_sample(t,(v-mean(v))./std(v),10); corr_length = 0.9000 [tau,rhox] = process_correlation_sample(t,(x-mean(x))./std(x),10); corr_length = 0.6000 figure plot(tau,rhov) hold Current plot held plot(tau,rhox,'g') diary off