[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Re: A new version of bicubic in Octave
From: |
Hoxide Ma |
Subject: |
Re: Re: A new version of bicubic in Octave |
Date: |
Fri, 2 Sep 2005 22:26:00 +0800 (CST) |
Thank you for you to notice me this bug.
it's not only a mistake in typeing. It's a big
mistake,
I have read the interp2.m especially the part of
'linear', then fixed the bug in bicubic.m .
now follow codes work well:
A=[13,-1,12;5,4,3;1,6,2];
x=[0,1,4]+10; y=[-10,-9,-8];
xi=linspace(min(x),max(x),17);
yi=linspace(min(y),max(y),26);
mesh(xi,yi,bicubic(x,y,A,xi,yi));
[x,y] = meshgrid(x,y);
__gnuplot_raw__ ("set nohidden3d;\n")
hold on; plot3(x(:),y(:),A(:),"b*"); hold off;
but :
...
mesh(xi,yi,interp2(x,y,A,xi,yi,'cubic'));
...
have a problem.
you see the end of yi value is be eated :$
I will try to fix this problem.
In fact, the reason is that Y is negative, then Y *
(1+eps) < Y, it's an expection. In my bicubic code , i
fixed this bug by move all points into positive part.
I attach the new version of bicubic.m
--- Paul Kienzle <address@hidden>写道:
> Fixed bug in line:
>
> t = 1 + (YI-Y(1))./((Y(rz)-Y(1))/(rz-1));
>
> One of the Y was an X.
>
>
> Doesn't work for X non-uniform. E.g.:
>
> A=[13,-1,12;5,4,3;1,6,2];
> x=[0,1,4]+10; y=[-10,-9,-8];
> xi=linspace(min(x),max(x),17);
> yi=linspace(min(y),max(y),26);
> mesh(xi,yi,interp2(x,y,A,xi,yi,'cubic'));
> [x,y] = meshgrid(x,y);
> __gnuplot_raw__ ("set nohidden3d;\n")
> hold on; plot3(x(:),y(:),A(:),"b*"); hold off;
>
> - Paul
>
>
> On Aug 28, 2005, at 9:43 AM, Hoxide Ma wrote:
>
> > It's really a new version , not based on any
> commerce
> > codes.
> >
> > It's based on my note:
> >
> > http://wiki.woodpecker.org.cn/moin/Octave/Bicubic?
>
> > action=AttachFile&do=get&target=bicubic.pdf
> >
> > You can test my code by run intt1.m and intt2.m .
> >
> > intt2.m is a example to interpolation by a
> > anomalistic surface.
> >
> > BTW: I'm sorry for my poor English :P
> >
> >
>
==========================================================
> >
> > A student of Math in Soochow University in China.
> > Intrested in Math, Python, Octave, Lisp, Maxima,
> Prolog and .NET/MONO.
> >
> > Blog: http://blog.sina.com.cn/blog/1142604745
> > Wiki: http://wiki.woodpecker.org.cn/moin/Hoxide
> >
> >
> >
> >
> >
> >
> >
>
___________________________________________________________
> > 雅虎免费G邮箱-中国第一绝无垃圾邮件骚扰超大邮箱
> > http://cn.mail.yahoo.com
> > <interp2.m><intt1.m><intt2.m><bicubic.m>
>
>
==========================================================
A student of Math in Soochow University in China.
Intrested in Math, Python, Octave, Lisp, Maxima, Prolog and .NET/MONO.
Blog: http://blog.sina.com.cn/blog/1142604745
Wiki: http://wiki.woodpecker.org.cn/moin/Hoxide
___________________________________________________________
雅虎免费G邮箱-No.1的防毒防垃圾超大邮箱
http://cn.mail.yahoo.com
bicubic.m
Description: pat1535429516