Home > atmlab > gridcreation > annealing > test_freq_set.m

test_freq_set

PURPOSE ^

TEST_FREQ_SET

SYNOPSIS ^

function e = test_freq_set(s, y_ref, H, y_mono, use_rel_error)

DESCRIPTION ^

 TEST_FREQ_SET

 Test a frequency selection.

 FORMAT e = test_freq_set(s, y_ref, H, y_mono)

 OUT e = RMS error of this selection, compared to reference

 IN  s       frequency set (type logical, dimension must match H)
     y_ref   reference Tbs, result of H*y_mono
     H       Weight matrix
     y_mono  a batch of monochromatic Tbs (dimension must match
             y_ref and w)
     use_rel_error Flag: If true then use relative error instead
                   of absolute error.

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

DOWNLOAD ^

test_freq_set.m

SOURCE CODE ^

0001 % TEST_FREQ_SET
0002 %
0003 % Test a frequency selection.
0004 %
0005 % FORMAT e = test_freq_set(s, y_ref, H, y_mono)
0006 %
0007 % OUT e = RMS error of this selection, compared to reference
0008 %
0009 % IN  s       frequency set (type logical, dimension must match H)
0010 %     y_ref   reference Tbs, result of H*y_mono
0011 %     H       Weight matrix
0012 %     y_mono  a batch of monochromatic Tbs (dimension must match
0013 %             y_ref and w)
0014 %     use_rel_error Flag: If true then use relative error instead
0015 %                   of absolute error.
0016 
0017 function e = test_freq_set(s, y_ref, H, y_mono, use_rel_error)
0018 
0019 % Number of channels:
0020 x = size(H);
0021 nchannels = x(1);
0022 
0023 %keyboard
0024 
0025 H_red = H(:,s);
0026 
0027 % Normalize correctly
0028 %for i=1:nchannels
0029 %  H_norm = sum(H_red(i,:));
0030 %  H_red(i,:) = H_red(i,:) / H_norm;
0031 %end
0032 % We do no longer normalize, since the matrix H contains the
0033 % correct weights, calculated by linear regression. (And in fact
0034 % H is also explicitly normalized to one.)
0035 
0036 y_mono_red = y_mono(s,:);
0037 
0038 y_test = H_red * y_mono_red;
0039 
0040 if (use_rel_error)
0041 %  disp('Using relative error!')
0042   d = (y_test - y_ref)./y_ref;  
0043 else
0044 %  disp('Using absolute error!')
0045   d = y_test - y_ref;  
0046 end
0047 
0048 e = rms(d);

Generated on Mon 15-Sep-2014 13:31:28 by m2html © 2005