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:
finding interpolated elements between 2 arrays

Subject: finding interpolated elements between 2 arrays

From: Jonathan W Smith

Date: 19 Mar, 2013 22:44:19

Message: 1 of 7

Hello:
Let's say I have 2 arrays, both having totally different elements. The elements in the 3rd dimension decrease exponentially with increasing n so array A has dimensions of 5x5x5 in the 3rd dimension the elements in A(:,:,1) are greater than A(:,:,2) and so on.

And same for array B which has dimensions of 5x5x3

How do I find the interpolated elements of the 3rd dimension of array B in array A? I imagine I would need to use interp3, ba_interp3 or perhaps neither.

Another way to look at it is the following if

A(1,2,:) = [900, 800, 700, 600, 500] and B(1,2,:) = [823, 689, 558] , how do I find the elements given in B in A?

Thanks
Jonathan

Subject: finding interpolated elements between 2 arrays

From: dpb

Date: 19 Mar, 2013 23:27:37

Message: 2 of 7

On 3/19/2013 5:44 PM, Jonathan W Smith wrote:
...

>
> Another way to look at it is the following if
>
> A(1,2,:) = [900, 800, 700, 600, 500] and B(1,2,:) = [823, 689, 558] ,
> how do I find the elements given in B in A?
>
...

Maybe so, but I don't see it, however I look. "The elements given in B
in A" aren't...

What result do you want and show how you get it from the above...

--

Subject: finding interpolated elements between 2 arrays

From: Jonathan W Smith

Date: 20 Mar, 2013 03:16:12

Message: 3 of 7

dpb <none@non.net> wrote in message <kias80$gik$1@speranza.aioe.org>...
> On 3/19/2013 5:44 PM, Jonathan W Smith wrote:
> ...
>
> >
> > Another way to look at it is the following if
> >
> > A(1,2,:) = [900, 800, 700, 600, 500] and B(1,2,:) = [823, 689, 558] ,
> > how do I find the elements given in B in A?
> >
> ...
>
> Maybe so, but I don't see it, however I look. "The elements given in B
> in A" aren't...
>
> What result do you want and show how you get it from the above...
>
> --

I want to show an array C Where C(1,2,:) = [900, 823, 800, 700, 689, 600, 558, 500]. Would this be an interpolation> If I were to plot this, I would want to see values spaced out exponentially from each other.

Jonathan

Subject: finding interpolated elements between 2 arrays

From: dpb

Date: 20 Mar, 2013 04:45:26

Message: 4 of 7

On 3/19/2013 10:16 PM, Jonathan W Smith wrote:
> dpb <none@non.net> wrote in message <kias80$gik$1@speranza.aioe.org>...
>> On 3/19/2013 5:44 PM, Jonathan W Smith wrote:
>> ...
>>
>> >
>> > Another way to look at it is the following if
>> >
>> > A(1,2,:) = [900, 800, 700, 600, 500] and B(1,2,:) = [823, 689, 558] ,
>> > how do I find the elements given in B in A?
>> >
>> ...
>>
>> Maybe so, but I don't see it, however I look. "The elements given in B
>> in A" aren't...
>>
>> What result do you want and show how you get it from the above...
>
> I want to show an array C Where C(1,2,:) = [900, 823, 800, 700, 689,
> 600, 558, 500]. Would this be an interpolation> If I were to plot this,
> I would want to see values spaced out exponentially from each other.

That's simply concatenating the two and sorting...

C=sort([A(1,2,:) B(1,2,:)],1,'descend');

How they would be plotted would depend on the independent variable
values you chose to plot them against. If they're given for both A and
B, one would presume the same ordering would hold for them as well.

--

Subject: finding interpolated elements between 2 arrays

From: Jonathan W Smith

Date: 20 Mar, 2013 12:31:15

Message: 5 of 7

dpb <none@non.net> wrote in message <kibers$n1j$1@speranza.aioe.org>...
> On 3/19/2013 10:16 PM, Jonathan W Smith wrote:
> > dpb <none@non.net> wrote in message <kias80$gik$1@speranza.aioe.org>...
> >> On 3/19/2013 5:44 PM, Jonathan W Smith wrote:
> >> ...
> >>
> >> >
> >> > Another way to look at it is the following if
> >> >
> >> > A(1,2,:) = [900, 800, 700, 600, 500] and B(1,2,:) = [823, 689, 558] ,
> >> > how do I find the elements given in B in A?
> >> >
> >> ...
> >>
> >> Maybe so, but I don't see it, however I look. "The elements given in B
> >> in A" aren't...
> >>
> >> What result do you want and show how you get it from the above...
> >
> > I want to show an array C Where C(1,2,:) = [900, 823, 800, 700, 689,
> > 600, 558, 500]. Would this be an interpolation> If I were to plot this,
> > I would want to see values spaced out exponentially from each other.
>
> That's simply concatenating the two and sorting...
>
> C=sort([A(1,2,:) B(1,2,:)],1,'descend');
>
> How they would be plotted would depend on the independent variable
> values you chose to plot them against. If they're given for both A and
> B, one would presume the same ordering would hold for them as well.
>
> --

This is helpful. Thanks. Would one be able to do this for the 3rd dimension across the entire array at once:

C = sort([A B], 3, 'descend') ?

Subject: finding interpolated elements between 2 arrays

From: Bruno Luong

Date: 20 Mar, 2013 13:00:08

Message: 6 of 7


>
> This is helpful. Thanks. Would one be able to do this for the 3rd dimension across the entire array at once:
>
> C = sort([A B], 3, 'descend') ?

sort(cat(3,A,B),2,'descend')

% Bruno

Subject: finding interpolated elements between 2 arrays

From: dpb

Date: 20 Mar, 2013 13:40:40

Message: 7 of 7

On 3/20/2013 8:00 AM, Bruno Luong wrote:
>
>>
>> This is helpful. Thanks. Would one be able to do this for the 3rd
>> dimension across the entire array at once:
>> C = sort([A B], 3, 'descend') ?
>
> sort(cat(3,A,B),2,'descend')
> % Bruno

IIUC the request correctly would be

sort(cat(3,A,B),3,'descend')

to sort by plane.

--

Tags for 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