Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

New to MATLAB?

Thread Subject:
division of intervals

Subject: division of intervals

From: antonio ferreira

Date: 12 Aug, 2011 17:15:31

Message: 1 of 1

Hi all.
I have a vector b=[0 1 3 5 6 7 8 10 10.5 13 14 15] that is composed by several points in x direction (the origin can be placed in b(1)) . Basically I need to find two fixed lengths that ensure that I have the same number of points in consecutive zones from b(1) to b(12). To illustrate this, for example, if I consider 2 lengths (leng1=3.5 and leng2=4) for this case I will like to have four vectores:
zone1=[0 1 3 ] (from x=0 to x=3.5) (associated to leng1)
zone2=[ 5 6 7] (from x=3.5 to x=7.5) (associated to leng2)
zone3=[8 10 10.5] (from x=7.5 to x=11) (associated to leng1)
zone4=[13 14 15] (from x=11 to x=15) (associated to leng2)
In the case that i presented is very easy to define leng1 and leng2 but in my "real case" b is a much bigger matrix and it is inside a loop that`s why i need to consider an automatic way of finding leng1 and leng2. Can anybody give me a hint on this please?

Tags for this Thread

No tags are associated with this thread.

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.

Contact us