Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

Views expressed in these public forums are not endorsed by Drexel University or The Math Forum.


Math Forum » Discussions » Software » comp.soft-sys.matlab

Topic: Selecting specific part of matrix through interpolation
Replies: 1   Last Post: Feb 13, 2013 2:24 PM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View  
dpb

Posts: 8,168
Registered: 6/7/07
Re: Selecting specific part of matrix through interpolation
Posted: Feb 13, 2013 2:24 PM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

On 2/12/2013 5:10 PM, James Smith wrote:
> I have a matrix of amplitudes, which correspond to distance on the x
> axis and time on the y axis. I need to create an interpolated line
> between a point on the x axis and a point on the y axis, and then remove
> everything above this line. For example I have the amplitudes, with time
> in the y direction and distance in the x. I want to remove from (1,5)
> (the top 5), to (4,1).
>
> 1 2 3 4 5 6 7 8 9
> 2 3 4 5 6 7 8 9 0
> 3 4 5 6 7 8 9 0 1
> 4 5 6 7 8 9 0 1 2
> 5 6 7 8 9 0 1 2 3
>
> Remove:
> 1 2 3 4 5
> 2 3 4 5
> 3 4 5
> 4
> Whilst interpolating along the line between the points (1,5) and (4,1).
> I have tried using the interp2 function but with no luck. Any
> help/advice would be very much appreciated, thanks.


Look at contourc

Given the above

contourc(x,[5,5])

will return a 2-row array the first six columns of which will be

5 5 4 3 2 1
5 1 2 3 4 5

where the first column is the contour level requested (5) while the
remainder in the first row is the column the contour passes thru (x)
while the second is the row (y) of the (x,y) point pairs. You can use
these pairs as the intersection points of your selection process.

If the data aren't even so the values aren't integers, you can either
fix() or round() depending on which way you want the truncation to happen...

doc contourc % takes some perusing to grasp but think it's what u asked

--





Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.