From: us on
"Ganesh " <nganesh76(a)hotmail.com> wrote in message <i3715k$8p$1(a)fred.mathworks.com>...
> B=interp2(A,1:0.1:65,1:0.1:53);
> ??? Error using ==> interp2 at 147
> XI and YI must be the same size or vectors of different orientations.
>
> Thank you!
>
> "Matt J " <mattjacREMOVE(a)THISieee.spam> wrote in message <i37000$fda$1(a)fred.mathworks.com>...
> >
> >
> > Call interp2 in 5-argument form,
> >
> > interp2(1:65, 1:53, Z, 1:0.2:65, 1:0.2:53)

> Lets say my rectangular grid is called A of size(65,53) & type double. I am looking to make it into a larger matrix with separation 0.1cm instead of 0.5 cm and call this as matrix B. Can you help me in using the interp2 command now? What is Z in your command? I tried it but in vain.

well...
what about: A(?)...

also note: you must enter your YIs as a col vec for this to work, eg,

m=magic(3);
r=interp2(1:3,1:3,m,1:.5:3,(1:.5:3).'); % <- note the transpose()...

us
From: Ganesh on
Thank you!
It works well using this method, but only if you have a square matrix. To being with, I have a rectangular matrix. Any way to work around this restriction while using the interp2 command.
Suppose A=matrix of size 65x53 with 0.5 cm separation between each grid point. All I want to do is create another matrix B with 0.1 cm separation between grid points.

> well...
> what about: A(?)...
>
> also note: you must enter your YIs as a col vec for this to work, eg,
>
> m=magic(3);
> r=interp2(1:3,1:3,m,1:.5:3,(1:.5:3).'); % <- note the transpose()...
>
> us
From: us on
"Ganesh " <nganesh76(a)hotmail.com> wrote in message <i372g5$o5g$1(a)fred.mathworks.com>...
> Thank you!
> It works well using this method, but only if you have a square matrix. To being with, I have a rectangular matrix. Any way to work around this restriction while using the interp2 command.
> Suppose A=matrix of size 65x53 with 0.5 cm separation between each grid point. All I want to do is create another matrix B with 0.1 cm separation between grid points.
>
> > well...
> > what about: A(?)...
> >
> > also note: you must enter your YIs as a col vec for this to work, eg,
> >
> > m=magic(3);
> > r=interp2(1:3,1:3,m,1:.5:3,(1:.5:3).'); % <- note the transpose()...
> >
> > us

sigh...

m=[magic(3),2*magic(3)];
[nr,nc]=size(m);
r=interp2(1:nc,1:nr,m,1:.5:nc,(1:.5:nr).'); % <- note the transpose()...

us
From: Ganesh on
Oh, I got the order of rows, columns reversed.. thanks for the help with code. It works!

"us " <us(a)neurol.unizh.ch> wrote in message
>
> sigh...
>
> m=[magic(3),2*magic(3)];
> [nr,nc]=size(m);
> r=interp2(1:nc,1:nr,m,1:.5:nc,(1:.5:nr).'); % <- note the transpose()...
>
> us
First  |  Prev  | 
Pages: 1 2
Prev: xlsread Color of Cells
Next: electron Gun