Re: separating data



TideMan <mulgor@xxxxxxxxx> wrote in message <d853c3bb-586e-4dd6-8fb1-b6d569572246@xxxxxxxxxxxxxxxxxxxxxxxxxxx>...
On Jul 28, 8:54?am, "Travis " <sinuso...@xxxxxxxxxxx> wrote:
ImageAnalyst <imageanal...@xxxxxxxxxxxxxx> wrote in message <7409b471-e14d-489f-bdff-043113213...@xxxxxxxxxxxxxxxxxxxxxxxxxxxx>...
On Jul 27, 2:00?pm, "Travis " <sinuso...@xxxxxxxxxxx> wrote:
I have a dataset
(depth = -[0:5 5:-1:0 0:25 25:-1:0 0:26 26:-1:0];)
time = 1:118;
that I need to separate into sections of positive and negative slopes. ?I have been able to identify the regions using...

for i = 2:length(depth)-1;
if (depth(1,i-1)<=depth(1,i)) && (depth(1,i+1)>=depth(1,i))
g(i) = 1;
end
end

I know it is crude, but I couldn't come up with a better way. ?I need each of these regions to be part of 3d variables (u and d) so that I can tie them into a gui using the size of the variables.

------------------------------------------------------------------------
Are you aware of the diff() function?

OK, so that cleans up the for loop, but how would I then go about setting each + or - section as its own section in 3d variables?

Who knows what you mean by 3d variables? I have no idea.

But you can figure + and - by this:
dy=diff(depth)
iplus=find(dy > 0);
iminus=find(dy <= 0);
Now depth(iplus) are the depths where the slope is positive and depth
(iminus) are the depths where the slope is negative or zero.

Or alternatively (and preferably) by logical indexing:
iplus=dy > 0;
Now depth(iplus) are the depths where the slope is positive and depth
(~iplus) are the depths where slope is negative or zero.

What I mean by 3d variable is a variable x(:,:,:) where each section of + or - has its own x and y. so that the first period of negative slope would be sldown(1,:,:), second sldown(2,:,:), etc.
.



Relevant Pages

  • Re: separating data
    ... that I need to separate into sections of positive and negative slopes.. ... Now depthare the depths where the slope is positive and depth ... are the depths where the slope is negative or zero. ...
    (comp.soft-sys.matlab)
  • Re: The relatvisitic computer
    ... |> No, it travels from A to B and back to A, a non-zero distance. ... |> It travels from A to B at velocity c, ... the average velocity is zero and therefore not really ... |> 'c' has slope zero with respect to any coordinate. ...
    (sci.physics.relativity)
  • Re: Answering Kleinman Re: The Theory of Evolution is a mathematically
    ... then computed the slope on the surface and used that information to ... The roots to these equations occurred when the ... Wouldn't setting the slopes of the derivatives to zero give you the ...
    (talk.origins)
  • Re: Answering Kleinman Re: The Theory of Evolution is a mathematically
    ... then computed the slope on the surface and used that information to ... The roots to these equations occurred when the ... Wouldn't setting the slopes of the derivatives to zero give you the ...
    (talk.origins)
  • Re: Answering Kleinman Re: The Theory of Evolution is a mathematically
    ... then computed the slope on the surface and used that information to ... The roots to these equations occurred when the ... Wouldn't setting the slopes of the derivatives to zero give you the ...
    (talk.origins)