interp2 with huge matrix
古いコメントを表示
Hello
Problem: I have a matrix (M) with 6000 by 11000 elements of complex or double type. The task is to preform a second order polynomial transformation (shift and warp) with interp2().
[X Y] = meshgrid(1:11000,1:6000); % very fast
% A and B are the coefficients
transY = A(1) + A(2)*Y + A(3)*X + A(4)*X.*Y + A(5)*X.^2 + A(6)*Y.^2; % very fast
transX = B(1) + B(2)*Y + B(3)*X + B(4)*X.*Y + B(5)*X.^2 + B(6)*Y.^2; % very fast
ZI = interp2(X,Y,M,transX,transY); % out of memory
The interp2() is very slow and as you can see there are four very large matrices and ZI would be the 5th, so running out of memory is always the case.
How to solve this problem?
So far I have tried to cut the matrix into tiles, but this does not work because of the NaN values for each tile.
Thanks in advance!
回答 (1 件)
the cyclist
2011 年 7 月 6 日
0 投票
By "cut the matrix into tiles" do you mean doing the interpolation by sections (such as X=1:1000, then X=1001:1100, etc)? I would expect that to work, if handled properly and being careful about edge cases. Maybe you should post the code you used to try to do that part.
2 件のコメント
Michael
2011 年 7 月 6 日
Ashish Uthama
2011 年 7 月 6 日
Michael, consider editing your question to add this code with proper formatting. Aside: blkproc or blockproc might be useful(?).
カテゴリ
ヘルプ センター および File Exchange で Interpolation についてさらに検索
製品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!