Is there a bug in the INTERP2 function within MATLAB 6.5 (R13) when using the "*" methods?

1 次查看(过去 30 天)
The documentation states that for "ZI = interp2(X,Y,Z,XI,YI, method) ", "you can pass in the row and column vectors XI and XI, respectively. In this case, interp2 interprets these vectors as if you issued the command meshgrid(XI,YI)." However, this is not the case when the method is prepending with an "*". To view an example of this, generate the following data:
load census
[xg yg]=meshgrid(cdate,pop);
xi = 1800:20:2000; yi = [1:30]';
zg = rand(21,21);
Then, the following command executes correctly as stated in the documentation:
interp2(xg,yg,zg,xi,yi,'nearest')
However, when the method is changed to "*nearest"
interp2(xg,yg,zg,xi,yi,'*nearest')
I receive an error message.
??? Error using ==> interp2 (nearest)
XI and YI must be the same size.

采纳的回答

MathWorks Support Team
This bug has been fixed in Release 2006a (R2006a). For previous product releases, read below for any possible workarounds:
This bug has been fixed in MATLAB 7.0 (R14). If you are using a previous version, see the following information.
This is a bug in the INTERP2 function within MATLAB (6.5) R13.
Currently, to work around this issue, you must use the MESHGRID command prior to calling INTERP2 when using a method with the "*" indicator.
[xi yi] = meshgrid(xi,yi);
interp2(xg,yg,zg,xi,yi,'*nearest')

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Startup and Shutdown 的更多信息

标签

产品


版本

R13SP1

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by