Filter löschen
Filter löschen

difference between 2 matrices of different dimensions.

2 Ansichten (letzte 30 Tage)
Abhijith
Abhijith am 27 Okt. 2011
In the 2d heat problem, I have calculated the solution(U) for various step lengths U_8 (for h=8) and U_16 for (h=16), where h is the step length. I want to compare the two(i.e U_8 and U_16), one way is to reduce the 16x16(U_16) solution into a 8x8(U*_8) one and find the norm of the difference between U*_8 and U_8. For this the way I am doing is not smart, I am handpicking the elements from the larger matrix(U_16) corresponding to the smaller one(U_8). Is there any better way to compare the 2 matrices.
Thanks in advance.

Antworten (2)

Fangjun Jiang
Fangjun Jiang am 27 Okt. 2011
U_16=rand(16,16);
index=1:2:16; % or index=2:2:16;
U_8New=U_16(index,index);

Walter Roberson
Walter Roberson am 27 Okt. 2011
There are a number of different ways you might want to proceed. You might want to imresize(), or you might want to resample(), or you might want to interp2(), or you might want to do plain sub-sampling. One of the filter based methods would be to fft2(), remove higher frequency components, and ifft2(). You might want to take medians, you might want to take averages...
The method you will want to choose will depend in part upon the degree to which the additional information available in U_16 should be reflected when comparing to U_8 .
Is each computed value a "fact", or is it an "approximation" whose correctness is informed by what is around, or are the values subject to noise (and if so, what kind) ?

Kategorien

Mehr zu Just for fun finden Sie in Help Center und File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by