Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

How to do common of n range using C/C++?

Status
Not open for further replies.

ahmed osama

Full Member level 6
Full Member level 6
Joined
Jul 18, 2004
Messages
352
Helped
2
Reputation
4
Reaction score
0
Trophy points
1,296
Location
Cairo, Egypt, Egypt
Activity points
2,652
Dear All

now i have for example 3 ranges

A: 1 ----------- 5
B: 2-------------6
C: 3-----------7


the common range is 3-------5

how can i do that using Math !!! to be able to do it using c/c++ or excel !!

For all Math Prof. help me thx


bye
 

common of n range !!

simple for loops in C or matlab
 

common of n range !!

BTW there is an intersect function in matlab
 

common of n range !!

maximum of left endpoints of A,B and C is the lower bound and the minimum of the right endpoints is the upper
 

common of n range !!

Hi ahmed osama.
Cherrytart says the minima and maxima can do it.
You take the smallest range.
compare the lower bounds of other ranges to find the largest.
compare the upper bounds of other ranges to find the smallest.
hope this does the trick
tara
 

Re: common of n range !!

ahmed_Osama,
In Excel, do the following:
Put the lower bounds of the ranges in a column
Put the corresponding upper ranges in the next column
Use the Small, Large Excel Functions.
For your example, say, let colums B3:B5, C3:C5 contain
. 1 5
. 2 6
. 3 7
Put the formula =Large(B3:B5,1) in Cell B6
Put the formula =Small(C3:C5) in cell C6
Cells B6, C6 now contain the upper, lower bounds of the common range.
This essentially implements the scheme outlined by cherrytart
Regards,
Kral

Added after 14 minutes:

ahmed osama,
Ooops! The 2nd formula should read "=Small(C3:C5,1)". I forgot to put in the 2nd parameter of the function.
Regards,
Kral
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top