Undocumented changes in interpn from Matlab 2012a to 2012b

Hi, the following code results in completely different interpolation results depending on if you use Matlab 2012a or Matlab 2012b versions. There is no documented changes for this function...
apod_matrices = interpn(t, ch_in_az, ch_in_el, apod_matrix, t, ch_out_az, ch_out_el, 'linear', 0);
I have stored the data file to load to run this code on my FTP: folk.ntnu.no/denarie/v2012a.mat
You can easily test the difference using:
load('v2012a.mat');
apod_matrices = interpn(t, ch_in_az, ch_in_el, apod_matrix, t, ch_out_az, ch_out_el, 'linear', 0);
sum(isnan(apod_matrices(:)))
the result is "0" in 2012a and "5940" in Matlab 2012b.
Could you please explain what is happening?
(I am using Windows 7 - 64 bit)

2 Comments

You have both release installed on the same machine and both MATLABs are 64 bit installations? I am asking because you also can install 32 bit MATLAB on a 64 bit machine.
Yes I have both 64 bits releases installed on my machine.

Sign in to comment.

 Accepted Answer

There is a reported issue that is currently under investigation. Please contact Technical Support with this issue and refer to "solution 1-K4TSEV"

1 Comment

Ok, thanks a lot, I have opened a Service request in the Technical Support (ref 1-LB036F).

Sign in to comment.

More Answers (1)

This is indeed a bug in R2012b, which produces different results compared to R2012a. It is planned to be resolved in future releases.

2 Comments

The workaround for this issue, is to convert the query matrices to column vectors, and then resize the output matrix.
apod_matrices2 = interpn(t, ch_in_az, ch_in_el, apod_matrix, t(:), ch_out_az(:), ch_out_el(:), 'linear', 0);
reshape(apod_matrices2,size(ch_out_az));
sum(isnan(apod_matrices2(:)))
Is the error I get with the following in 2012b related?
a1 = [1 2 3] ; a2 = [4 5 6 7] ; a3 = [8 9 10 11 12] ;
vv = zeros(length(a1), length(a2), length(a3)) ;
x1 = [1.5] ; y1 = [4.5] ; z1 = [8.5 9.5 10.5 11.5] ;
% Next line works in 2010b, but not in 2012b.
yy = interpn(a1, a2, a3, vv, x1, y1, z1) ;
% Next line works in 2010b and 2012b.
[x11,y11,z11] = ndgrid(x1,y1,z1) ;
yy2 = interpn(a1, a2, a3, vv, x11, y11, z11) ;
diff1 = squeeze(yy2 - yy)

Sign in to comment.

Categories

Products

Community Treasure Hunt

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

Start Hunting!