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

Thread Subject:
Can anybody help me on this?

Subject: Can anybody help me on this?

From: Tewodros Hassen

Date: 11 Jan, 2011 18:11:05

Message: 1 of 6

I have inputs between 55 and 65 i.e any number between these numbers and inclusive of 55 and 65. When I receive each of these numbers I want to uniquely match the received number to a number between 65 and 70 inclusive. I don't care if the match is not unique but it is unique it would be more comfortable for further processing. Any help is greatly appreciated. Thank you. PS: numbers are rational numbers.

Subject: Can anybody help me on this?

From: Sean de

Date: 11 Jan, 2011 18:34:07

Message: 2 of 6

"Tewodros Hassen" wrote in message <igi6fp$13a$1@fred.mathworks.com>...
> I have inputs between 55 and 65 i.e any number between these numbers and inclusive of 55 and 65. When I receive each of these numbers I want to uniquely match the received number to a number between 65 and 70 inclusive. I don't care if the match is not unique but it is unique it would be more comfortable for further processing. Any help is greatly appreciated. Thank you. PS: numbers are rational numbers.

What do you mean match? Provide a small example.
Is this what you meant?
x = 58;
y = 65+((x-55)/11)*6;

Where:
65 = minimum of 65,70
11 = numel(55:65)
6 = numel(65:70);
55 = minimum of 55,65

Subject: Can anybody help me on this?

From: I am too much me

Date: 11 Jan, 2011 19:45:30

Message: 3 of 6

On 11-01-11 12:11 PM, Tewodros Hassen wrote:
> I have inputs between 55 and 65 i.e any number between these numbers and
> inclusive of 55 and 65. When I receive each of these numbers I want to
> uniquely match the received number to a number between 65 and 70 inclusive. I
> don't care if the match is not unique but it is unique it would be more
> comfortable for further processing. Any help is greatly appreciated. Thank
> you. PS: numbers are rational numbers.

x in [A,B] maps to [C,D] as

C + (D-C) .* (x-A)./(B-A)

The mapping is unique if the range of C to D is at least as great as the range
from A to B. In your case, your 65 to 70 range is only roughly half the size
of the 55 to 65 range, so duplicates will occur. You probably won't notice,
though, because in your case, the original values would have to be closer
together than 1.4210854715202e-14 in order to map to end up mapped together in
the new range.

Subject: Can anybody help me on this?

From: Tewodros Hassen

Date: 11 Jan, 2011 19:55:05

Message: 4 of 6

"Sean de " <sean.dewolski@nospamplease.umit.maine.edu> wrote in message <igi7qu$s17$1@fred.mathworks.com>...
> "Tewodros Hassen" wrote in message <igi6fp$13a$1@fred.mathworks.com>...
> > I have inputs between 55 and 65 i.e any number between these numbers and inclusive of 55 and 65. When I receive each of these numbers I want to uniquely match the received number to a number between 65 and 70 inclusive. I don't care if the match is not unique but it is unique it would be more comfortable for further processing. Any help is greatly appreciated. Thank you. PS: numbers are rational numbers.
>
> What do you mean match? Provide a small example.
> Is this what you meant?
> x = 58;
> y = 65+((x-55)/11)*6;
>
> Where:
> 65 = minimum of 65,70
> 11 = numel(55:65)
> 6 = numel(65:70);
> 55 = minimum of 55,65

Thank you, man! that was one big help. Just one thing. For x = 65 it goes beyond 70. May be I use floor function to correct that

Subject: Can anybody help me on this?

From: Tewodros Hassen

Date: 11 Jan, 2011 20:33:05

Message: 5 of 6

I am too much me <roberson@hushmail.com> wrote in message <igic36$t79$1@nrc-news.nrc.ca>...
> On 11-01-11 12:11 PM, Tewodros Hassen wrote:
> > I have inputs between 55 and 65 i.e any number between these numbers and
> > inclusive of 55 and 65. When I receive each of these numbers I want to
> > uniquely match the received number to a number between 65 and 70 inclusive. I
> > don't care if the match is not unique but it is unique it would be more
> > comfortable for further processing. Any help is greatly appreciated. Thank
> > you. PS: numbers are rational numbers.
>
> x in [A,B] maps to [C,D] as
>
> C + (D-C) .* (x-A)./(B-A)
>
> The mapping is unique if the range of C to D is at least as great as the range
> from A to B. In your case, your 65 to 70 range is only roughly half the size
> of the 55 to 65 range, so duplicates will occur. You probably won't notice,
> though, because in your case, the original values would have to be closer
> together than 1.4210854715202e-14 in order to map to end up mapped together in
> the new range.

Just worked fine, man. Thank you.

Subject: Can anybody help me on this?

From: ImageAnalyst

Date: 12 Jan, 2011 00:33:04

Message: 6 of 6

On Jan 11, 2:55 pm, "Tewodros Hassen" <wtewod...@yahoo.com> wrote:
> Thank you, man! that was one big help. Just one thing. For x = 65 it goes beyond 70. May be I use floor function to correct that
--------------------------------------------------
No, you use the min function for that.
y = min([y 70]); % clip to 70 or less.

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