Thread Subject: monotonic increasing or decreasing

Subject: monotonic increasing or decreasing

From: Mike

Date: 3 Oct, 2009 03:02:59

Message: 1 of 3

Hi

I search the web, but don't find any command about monotonic check.
Given a series of data, I'd like to check if it is monotonic
increasing or decreasing.

Mike

Subject: monotonic increasing or decreasing

From: Matt Fig

Date: 3 Oct, 2009 03:11:01

Message: 2 of 3

One approach:

x = [1 2 3 4 5 6]
all(diff(x)>0) % increasing
% But now:
x(7) = 3
all(diff(x)>0)

Subject: monotonic increasing or decreasing

From: Mike

Date: 3 Oct, 2009 03:16:31

Message: 3 of 3

On Oct 3, 11:11 am, "Matt Fig" <spama...@yahoo.com> wrote:
> One approach:
>
> x = [1 2 3 4 5 6]
> all(diff(x)>0)  % increasing
> % But now:
> x(7) = 3
> all(diff(x)>0)

Thank you. It works.

Mike

Tags for this Thread

Add a New Tag:

Separated by commas
Ex.: root locus, bode

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

rssFeed for this Thread

Contact us at files@mathworks.com