Path: news.mathworks.com!newsfeed-00.mathworks.com!kanaga.switch.ch!switch.ch!newsfeed00.sul.t-online.de!t-online.de!newspeer2.de.telia.net!newspeer3.de.telia.net!de.telia.net!newspeer2.se.telia.net!se.telia.net!masternews.telia.net.!newsb.telia.net.POSTED!not-for-mail
From: PB <pbodin@_REMOVE_THiS_kth.se>
Subject: Re: Interpolation of matrix
Newsgroups: comp.soft-sys.matlab
References: <24FYi.13280$%j2.9607@newsfe2-win.ntli.net>
User-Agent: Pan/0.129 (Benson & Hedges Moscow Gold)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Lines: 39
Message-ID: <mRKYi.49$R_4.102@newsb.telia.net>
Date: Thu, 08 Nov 2007 21:04:18 GMT
NNTP-Posting-Host: 217.208.84.46
X-Complaints-To: abuse@telia.com
X-Trace: newsb.telia.net 1194555858 217.208.84.46 (Thu, 08 Nov 2007 22:04:18 CET)
NNTP-Posting-Date: Thu, 08 Nov 2007 22:04:18 CET
Organization: Telia Internet
Xref: news.mathworks.com comp.soft-sys.matlab:436643



Den Thu, 08 Nov 2007 14:30:22 +0000 skrev Ben:

> Hi there,
> 
> I'm trying to perform some operations on a matrix - I have a 20x20
> matrix that I've got to remove some rows from the top, and re-generate
> lines at the bottom to leave the matrix the same size as it was.
> 
> So, say I have a 10x10 matrix, I remove the top row. What I now want to
> do is generate a row between the row at the bottom, and the one above
> it, that I can put in to keep it 10x10.
> 
> I've looked at interp2, and it sort of seems to do what I want, e.g
> running interp2(Matrix) gives me a 19x19 matrix with an interpolated row
> between each. Is there any way to point interp2 at a matrix, with row
> vector 9, and get it to return a 1x10 matrix containing the interpolated
> row between row vectors 9 and 10, that I can just add to the first
> matrix?
> 
> I believe interp2 can sort-of do this, using Xi and Yi, but that appears
> to be more related to generating an interpolated value from two data
> points, not two rows?
> 
> Anyone have any advice?
> 
> Thanks,
> 
> Ben

Does this help?

a=magic(3);
a(:,3)=[]   % remove last row
ix=1:0.5:2;
[xi,yi]=meshgrid(ix)
y=interp2(a,xi,yi)


/PB