www.gusucode.com > wavelet工具箱matlab源码程序 > wavelet/wavelet/dtfilters.m

    function varargout = dtfilters(name,type)
%DTFILTERS Dual-Tree filters
%   [DF,RF] = DTFILTERS(NAME) returns the decomposition filters 
%   and the associated reconstruction filters which name
%   is given by the string NAME.
%
%   The valid values for NAME are:
%      - 'dtfP': 
%           returns the filters for the first step and the 
%           following steps, for dual-tree ('FSfarras' for the first
%           step and  'qshiftN' with P = 1, 2, 3 or 4 corresponding 
%           to N = 6, 10, 14 or 18 for the following steps) .
%
%      - 'dddtf1': 
%           returns the filters for the first step and the
%           following steps, for double density dual-tree
%           ('FSdoubledualfilt' and 'doubledualfilt').
%
%      - 'self1','self2': 
%           I W. Selesnick - 3-channel perfect reconstruction
%           filter bank
%
%      - 'filters1','filters2': NOT DOCUMENTED [] 
%           3-channel perfect reconstruction filter bank
%
%      - 'farras','FSfarras' (first step filter): 
%           nearly symmetric filters for orthogonal
%           2-channel perfect reconstruction filter bank
%
%      - 'qshiftN' with N = 6, 10, 14 or 18
%           Kingsbury Q-filters for the dual-tree complex DWT
%
%      - 'doubledualfilt','FSdoubledualfilt' (first step filter):
%           DF and RF are cell arrays of 3-channel filter bank
%
%      - 'AntonB': NOT DOCUMENTED []
%
%      - Orthogonal or biorthogonal wavelet names (see WFILTERS)
%
%	F = DTFILTERS(NAME,TYPE) returns the following filters:
%   Decomposition filters if type = 'd'
%   Reconstruction filters if type = 'r'
%
%   See also WFILTERS
%
%----------------------------------------------------------
%REFERENCES
%----------------------------------------------------------
% farras nearly symmetric filters for orthogonal
% 2-channel perfect reconstruction filter bank
% REF 1:
%    A. F. Abdelnour and I. W. Selesnick.
%    "Nearly symmetric orthogonal wavelet bases",
%    Proc. IEEE Int. Conf. Acoust., Speech,
%    Signal Processing (ICASSP), May 2001.
%----------------------------------------------------------
% REF 2:
%    N. G. Kingsbury,  "A dual-tree complex wavelet
%    transform with improved orthogonality and symmetry
%    properties", Proceedings of the IEEE Int. Conf. on
%    Image Proc. (ICIP), 2000
%----------------------------------------------------------
% 3-channel perfect reconstruction filter bank
% Symmetric Filters for the Double-Density Wavelet Transform
% REF 3:
%    I. W. Selesnick and A. Farras Abdelnour.
%    Symmetric wavelet tight frames with two generators.
%    Applied and Computational Harmonic Analalysis, 17(2), 2004.
%----------------------------------------------------------
% REF 4:
%	The Double-Density Dual-Tree Discrete Wavelet Transform
%	Ivan W. Selesnick
%	July 27, 2001
%	Electrical Engineering, Polytechnic University
%	Multirate Processing and Wavelets
%----------------------------------------------------------

%   M. Misiti, Y. Misiti, G. Oppenheim, J.M. Poggi 09-Nov-2012.
%   Last Revision: 11-Apr-2013.
%   Copyright 1995-2013 The MathWorks, Inc.

name = lower(name);
ok = true;
if isequal(name(1),'q')
    try
        ok = isequal(name(1:6),'qshift');
        numFilt  = str2double(name(7:end));
        if ~ismember(numFilt,[6 10 14 18]) , 
            ok = false;
        else
            name = 'qshift';
        end
    catch
        ok = false;
    end
    if ~ok
        msg = getWavMSG('Wavelet:moreMSGRF:Invalid_Wavelet',name);
        error(msg);
    end
elseif isequal(name(1:2),'dt')
    try
        ok = isequal(name(1:3),'dtf');
        numFilt  = str2double(name(4:end));
        if ~ismember(numFilt,1:4) , 
            ok = false;
        else
            name = 'dtf';
        end
    catch
        ok = false;
    end
end
if ~ok
    msg = getWavMSG('Wavelet:moreMSGRF:Invalid_Wavelet',name);
    error(msg);
end
switch name
    case 'dtf'
        [Df_FS,Rf_FS]  = dtfilters('Fsfarras');
        switch numFilt
            case 1 , [Df_next,Rf_next] = dtfilters('qshift6');
            case 2 , [Df_next,Rf_next] = dtfilters('qshift10');
            case 3 , [Df_next,Rf_next] = dtfilters('qshift14');
            case 4 , [Df_next,Rf_next] = dtfilters('qshift18');
        end
        Df = {Df_FS,Df_next};
        Rf = {Rf_FS,Rf_next};
        
    case 'dddtf1'
        [Df_FS,Rf_FS]  = dtfilters('FSdoubledualfilt');
        [Df_next,Rf_next] = dtfilters('doubledualfilt');
        Df = {Df_FS,Df_next};
        Rf = {Rf_FS,Rf_next};
        
    case 'self1'
        H = [...
             0.06911582051268  0.00007342378571  0.00016216892384
             0.35966127039020  0.00038207883303  0.00084388611367
             0.66578510237730 -0.00598664482533 -0.01366169688553
             0.46591894334945 -0.03433855126018 -0.07812787935415
            -0.01910143987094 -0.05544284199193 -0.08404354646603
            -0.13775229565904  0.00187143276342  0.22307058313047
            -0.00879228135716  0.13862717458070  0.39450869604392
             0.01947949838578  0.33211688782429 -0.65664993171756
             0.00009957952467 -0.56616644388191  0.21389772021137
            -0.00020063527985  0.18886348417221  0
            ];
        G = [...
             0.01382316410254  0.00036711892855  0.00081084461919
             0.18251756689833  0.00484734559355  0.01070618752183
             0.55379561515138  0.01295727262146  0.02642247548195
             0.64032052013227 -0.00610823096768 -0.04248472459154
             0.20240253780720 -0.06568401496723 -0.20956025899924
            -0.13270357516508 -0.09685196235772 -0.00551846607616
            -0.07143784469173 -0.02112084546363  0.65041073668340
             0.01797544572026  0.54923548323017 -0.47356633868171
             0.00852330881716 -0.41541486345192  0.04277954404227
            -0.00100317639923  0.03777269683444  0
            ];
        
        Df_FS{1} = H;   
        Df_FS{2} = G;
        Rf_FS{1} = Df_FS{1}(end:-1:1,:);
        Rf_FS{2} = Df_FS{2}(end:-1:1,:);
        Df = {Df_FS,Df_FS};
        Rf = {Rf_FS,Rf_FS};
        
    case 'self2'
        H = [...
             0.01167515006693  0.00000028033779  0.00000096316386
             0.11210453438921  0.00000269179728  0.00000924827821
             0.39020359888747 -0.00009458242812 -0.00032856572032
             0.63766002212216 -0.00098283172247 -0.00341136920868
             0.45159271169876 -0.00322600807907 -0.00984858347245
            -0.01779052717512 -0.00339847237922  0.00114352817725
            -0.18995098895800  0.00534784540227  0.05358462859672
            -0.03633171373566  0.02694106074718  0.07100034042574
             0.05116380416058  0.04999293344040 -0.07326560617712
             0.01309797742830 -0.00764246645306 -0.23356729557382
            -0.00814108745277 -0.21155330115108 -0.04788025853496
            -0.00163786108717 -0.13672353553244  0.58084573581233
             0.00056506737003  0.61809721274879 -0.40145448519473
             0.00000434924483 -0.39817251892698  0.06317171942796
            -0.00000147458644  0.06141169219871  0
             0                 0                 0 
        ];
        G = [...
             0.00166787858099  0.00000196236451  0.00000674214701
             0.04270099078000  0.00005024041316  0.00017261229964
             0.23192413512891  0.00023596311036  0.00078545980855
             0.54594099119669 -0.00030264225957 -0.00168611304984
             0.60903833681124 -0.00443438247636 -0.01814247165657
             0.21459366376196 -0.01230171877677 -0.03508479826925
            -0.16295875588933 -0.01563309030618  0.01806298323729
            -0.12839582439678  0.00449550768918  0.13569634310037
             0.03096765367958  0.07816842450995  0.09808771813111
             0.03738202154037  0.13192700814758 -0.19634137757248
            -0.00385258125359 -0.12443537362415 -0.37624919671465
            -0.00531066009030 -0.44659309709664  0.56741070948369
             0.00033043623380  0.57729947000603 -0.20174314229173
             0.00019559839462 -0.19725137058663  0.00902453134685
            -0.00001032210505  0.00877309888553  0
             0                 0                 0
        ];        
        Df_FS{1} = H;   
        Df_FS{2} = G;
        Rf_FS{1} = Df_FS{1}(end:-1:1,:);
        Rf_FS{2} = Df_FS{2}(end:-1:1,:);
        Df = {Df_FS,Df_FS};
        Rf = {Rf_FS,Rf_FS};
                
    case 'filters1'
        Df = [
          0.14301535070442  -0.01850334430500  -0.04603639605741
          0.51743439976158  -0.06694572860103  -0.16656124565526
          0.63958409200212  -0.07389654873135   0.00312998080994
          0.24429938448107   0.00042268944277   0.67756935957555
         -0.07549266151999   0.58114390323763  -0.46810169867282
         -0.05462700305610  -0.42222097104302   0
        ];
        Rf = Df(end:-1:1, :);

    case 'filters2'  %% NOMME filter1 dans l'article!? %%
        % 3-channel perfect reconstruction filter bank
        % Symmetric Filters for the Double-Density Wavelet Transform Reference:
        % I. W. Selesnick and A. Farras Abdelnour.
        % Symmetric wavelet tight frames with two generators. 
        % Applied and Computational Harmonic Analalysis, 17(2), 2004.
        Df = [
          0.00069616789827  -0.00014203017443   0.00014203017443
         -0.02692519074183   0.00549320005590  -0.00549320005590
         -0.04145457368920   0.01098019299363  -0.00927404236573
          0.19056483888763  -0.13644909765612   0.07046152309968
          0.58422553883167  -0.21696226276259   0.13542356651691
          0.58422553883167   0.33707999754362  -0.64578354990472
          0.19056483888763   0.33707999754362   0.64578354990472
         -0.04145457368920  -0.21696226276259  -0.13542356651691
         -0.02692519074183  -0.13644909765612  -0.07046152309968
          0.00069616789827   0.01098019299363   0.00927404236573
          0                  0.00549320005590   0.00549320005590
          0                 -0.00014203017443  -0.00014203017443
        ];
        Rf = Df(end:-1:1, :);
    
    case 'farras'
        % farras nearly symmetric filters for orthogonal
        % 2-channel perfect reconstruction filter bank
        % REFERENCE:
        %    A. F. Abdelnour and I. W. Selesnick.
        %    "Nearly symmetric orthogonal wavelet bases",
        %    Proc. IEEE Int. Conf. Acoust., Speech,
        %    Signal Processing (ICASSP), May 2001.
        Df = [
                          0  -0.01122679215254
                          0   0.01122679215254
          -0.08838834764832   0.08838834764832
           0.08838834764832   0.08838834764832
           0.69587998903400  -0.69587998903400
           0.69587998903400   0.69587998903400
           0.08838834764832  -0.08838834764832
          -0.08838834764832  -0.08838834764832
           0.01122679215254                  0
           0.01122679215254                  0
        ]; 
        Rf = Df(end:-1:1, :);
        
    case 'fsfarras'
        % Farras filters organized for the dual-tree complex DWT.
        %    Df{i}, i = 1,2 - Decomposition filters for tree i
        %    Rf{i}, i = 1,2 - Reconstruction filters for tree i
        Df{1} = [
                          0                  0
          -0.08838834764832  -0.01122679215254
           0.08838834764832   0.01122679215254
           0.69587998903400   0.08838834764832
           0.69587998903400   0.08838834764832
           0.08838834764832  -0.69587998903400
          -0.08838834764832   0.69587998903400
           0.01122679215254  -0.08838834764832
           0.01122679215254  -0.08838834764832
                          0                  0
         ];   
        Rf{1} = Df{1}(end:-1:1, :);

        Df{2} = [
           0.01122679215254                  0
           0.01122679215254                  0
          -0.08838834764832  -0.08838834764832
           0.08838834764832  -0.08838834764832
           0.69587998903400   0.69587998903400
           0.69587998903400  -0.69587998903400
           0.08838834764832   0.08838834764832
          -0.08838834764832   0.08838834764832
                          0   0.01122679215254
                          0  -0.01122679215254
        ];
        Rf{2} = Df{2}(end:-1:1, :);
        
    case {'qshift'}
        % Kingsbury Q-filters for the dual-tree complex DWT
        %
        % OUTPUT:
        %    Df{i}, i = 1,2 - analysis filters for tree i
        %    Rf{i}, i = 1,2 - synthesis filters for tree i
        %    note: Df{2} is the reverse of Df{1}
        % REFERENCE:
        %    N. G. Kingsbury,  "A dual-tree complex wavelet
        %    transform with improved orthogonality and symmetry
        %    properties", Proceedings of the IEEE Int. Conf. on
        %    Image Proc. (ICIP), 2000
        % These cofficients are rounded to 8 decimal places.
        switch numFilt
            case 6
                Df{1} = [
                     0.03516384000000   0
                     0                  0
                    -0.08832942000000  -0.11430184000000
                     0.23389032000000   0
                     0.76027237000000   0.58751830000000
                     0.58751830000000  -0.76027237000000
                     0                  0.23389032000000
                    -0.11430184000000   0.08832942000000
                     0                  0
                     0                 -0.03516384000000
                     ];

                Df{2} = [
                     0                 -0.03516384000000
                     0                  0
                    -0.11430184000000   0.08832942000000
                     0                  0.23389032000000
                     0.58751830000000  -0.76027237000000
                     0.76027237000000   0.58751830000000
                     0.23389032000000   0
                    -0.08832942000000  -0.11430184000000
                     0                  0
                     0.03516384000000   0
                     ];
                 
            case 10
                Df{1} = [
                     0.051130405283832  -0.006181881892116
                    -0.013975370246889   0.001689681272528
                    -0.109836051665971  -0.100231219507476
                     0.263839561058938  -0.000873622695217
                     0.766628467793037   0.563655710127052
                     0.563655710127052  -0.766628467793037
                     0.000873622695217   0.263839561058938
                    -0.100231219507476   0.109836051665971
                    -0.001689681272528  -0.013975370246889
                    -0.006181881892116  -0.051130405283832
                    ];

                Df{2} = [
                    -0.006181881892116  -0.051130405283832
                    -0.001689681272528  -0.013975370246889
                    -0.100231219507476   0.109836051665971
                     0.000873622695217   0.263839561058938
                     0.563655710127052  -0.766628467793037
                     0.766628467793037   0.563655710127052
                     0.263839561058938  -0.000873622695217
                    -0.109836051665971  -0.100231219507476
                    -0.013975370246889   0.001689681272528
                     0.051130405283832  -0.006181881892116
                    ];
                
            case 14
                Df{1} = [
                       0.003253142763653  -0.004556895628475
                      -0.003883211999158   0.005439475937274
                       0.034660346844853   0.017025223881554
                      -0.038872801268828  -0.023825384794920
                      -0.117203887699115  -0.106711804686665
                       0.275295384668882  -0.011866092033797
                       0.756145643892522   0.568810420712123
                       0.568810420712123  -0.756145643892522
                       0.011866092033797   0.275295384668882
                      -0.106711804686665   0.117203887699115
                       0.023825384794920  -0.038872801268828
                       0.017025223881554  -0.034660346844853
                      -0.005439475937274  -0.003883211999158
                      -0.004556895628475  -0.003253142763653
                    ];
                
                Df{2} = [
                      -0.004556895628475  -0.003253142763653
                      -0.005439475937274  -0.003883211999158
                       0.017025223881554  -0.034660346844853
                       0.023825384794920  -0.038872801268828
                      -0.106711804686665   0.117203887699115
                       0.011866092033797   0.275295384668882
                       0.568810420712123  -0.756145643892522
                       0.756145643892522   0.568810420712123
                       0.275295384668882  -0.011866092033797
                      -0.117203887699115  -0.106711804686665
                      -0.038872801268828  -0.023825384794920
                       0.034660346844853   0.017025223881554
                      -0.003883211999158   0.005439475937274
                       0.003253142763653  -0.004556895628475
                    ];                
                    
            case 18
                Df{1} = [
                      -0.002284127440271   0.002411869456666
                       0.001209894163073  -0.001277558653807
                      -0.011834794515431  -0.002576174306601
                       0.001283456999344   0.006628794612430
                       0.044365221606617   0.031526377122085
                      -0.053276108803047  -0.018156493945546
                      -0.113305886362143  -0.120188544710795
                       0.280902863222186  -0.024550152433667
                       0.752816038087856   0.565808067396459
                       0.565808067396459  -0.752816038087856
                       0.024550152433667   0.280902863222186
                      -0.120188544710795   0.113305886362143
                       0.018156493945546  -0.053276108803047
                       0.031526377122085  -0.044365221606617
                      -0.006628794612430   0.001283456999344
                      -0.002576174306601   0.011834794515431
                       0.001277558653807   0.001209894163073
                       0.002411869456666   0.002284127440271
                    ];
                
                Df{2} = [
                       0.002411869456666   0.002284127440271
                       0.001277558653807   0.001209894163073
                      -0.002576174306601   0.011834794515431
                      -0.006628794612430   0.001283456999344
                       0.031526377122085  -0.044365221606617
                       0.018156493945546  -0.053276108803047
                      -0.120188544710795   0.113305886362143
                       0.024550152433667   0.280902863222186
                       0.565808067396459  -0.752816038087856
                       0.752816038087856   0.565808067396459
                       0.280902863222186  -0.024550152433667
                      -0.113305886362143  -0.120188544710795
                      -0.053276108803047  -0.018156493945546
                       0.044365221606617   0.031526377122085
                       0.001283456999344   0.006628794612430
                      -0.011834794515431  -0.002576174306601
                       0.001209894163073  -0.001277558653807
                      -0.002284127440271   0.002411869456666
                    ];                
                
        end
        Rf{1} = Df{1}(end:-1:1, :);
        Rf{2} = Df{2}(end:-1:1, :);

    case 'doubledualfilt'
        %   Df - cell array containing analysis filters
        %       Df{1} - analysis filters for tree 1
        %       Df{2} - analysis filters for tree 2
        %   Rf - cell array containing synthesis filters
        %       Rf{1} - synthesis filters for tree 1
        %       Rf{2} - synthesis filters for tree 2
        Df{1} = [
           0.00017870679071  -0.00012344587034   0.00001437252392
          -0.02488304194507   0.01718853971559  -0.00200122286479
           0.00737700819766  -0.00675291099550   0.00027261232228
           0.29533805776119   0.02671809818132   0.06840460220387
           0.59529279993637  -0.64763513288874   0.01936710587994
           0.45630440337458   0.47089724990858  -0.68031992557818
           0.11239376309619   0.16040017815754   0.42976785708978
          -0.01971220693439  -0.01484700537727   0.11428688385011
          -0.00813549683439  -0.00588868840296   0.05057805218407
           0.00005956893024   0.00004311757177  -0.00037033761102
        ];
        Df{2} = [
           0.00005956893024   0.00004311757177  -0.00037033761102
          -0.00813549683439  -0.00588868840296   0.05057805218407
          -0.01971220693439  -0.01484700537727   0.11428688385011
           0.11239376309619   0.16040017815754   0.42976785708978
           0.45630440337458   0.47089724990858  -0.68031992557818
           0.59529279993637  -0.64763513288874   0.01936710587994
           0.29533805776119   0.02671809818132   0.06840460220387
           0.00737700819766  -0.00675291099550   0.00027261232228
          -0.02488304194507   0.01718853971559  -0.00200122286479
           0.00017870679071  -0.00012344587034   0.00001437252392
        ];

        % Swap the two highpass filters for Df{2}
        tmp = Df{2}(:,2);
        Df{2}(:,2) = Df{2}(:,3);
        Df{2}(:,3) = tmp;

        Rf{1} = Df{1}(end:-1:1,:);
        Rf{2} = Df{2}(end:-1:1,:);
        
    case 'fsdoubledualfilt'
        % OUTPUT:
        %   Df - cell array containing analysis filters
        %       Df{1} - analysis filters for tree 1
        %       Df{2} - analysis fitlers for tree 2
        %   Rf - cell array containing synthesis filters
        %       Rf{1} - synthesis filters for tree 1
        %       Rf{2} - synthesis filters for tree 2
        Df{1} = [
                          0                  0                  0
           0.00069616789827  -0.00014203017443   0.00014203017443
          -0.02692519074183   0.00549320005590  -0.00549320005590
          -0.04145457368920   0.01098019299363  -0.00927404236573
           0.19056483888763  -0.13644909765612   0.07046152309968
           0.58422553883167  -0.21696226276259   0.13542356651691
           0.58422553883167   0.33707999754362  -0.64578354990472
           0.19056483888763   0.33707999754362   0.64578354990472
          -0.04145457368920  -0.21696226276259  -0.13542356651691
          -0.02692519074183  -0.13644909765612  -0.07046152309968
           0.00069616789827   0.01098019299363   0.00927404236573
                          0   0.00549320005590   0.00549320005590
                          0  -0.00014203017443  -0.00014203017443
                          0                  0                  0
        ];
        Df{2} = [
                          0                  0                  0
                          0                  0                  0
           0.00069616789827  -0.00014203017443   0.00014203017443
          -0.02692519074183   0.00549320005590  -0.00549320005590
          -0.04145457368920   0.01098019299363  -0.00927404236573
           0.19056483888763  -0.13644909765612   0.07046152309968
           0.58422553883167  -0.21696226276259   0.13542356651691
           0.58422553883167   0.33707999754362  -0.64578354990472
           0.19056483888763   0.33707999754362   0.64578354990472
          -0.04145457368920  -0.21696226276259  -0.13542356651691
          -0.02692519074183  -0.13644909765612  -0.07046152309968
           0.00069616789827   0.01098019299363   0.00927404236573
                          0   0.00549320005590   0.00549320005590
                          0  -0.00014203017443  -0.00014203017443
        ];

        Rf{1} = Df{1}(end:-1:1, :);
        Rf{2} = Df{2}(end:-1:1, :);
        
    case 'antonb'
        D = [ ...
             0                     0
             0.02674875741081      0
            -0.01686411844287      0
            -0.07822326652899      0.04563588155712
             0.26686411844288     -0.02877176311425
             0.60294901823636     -0.29563588155712
             0.26686411844287      0.55754352622850
            -0.07822326652899     -0.29563588155713
            -0.01686411844287     -0.02877176311425
             0.02674875741081      0.04563588155712
             0                     0
             0                     0
             ];
         
       R = 2*[ ...
             0                     0
             0                     0.02674875741081
             0                     0.01686411844287
            -0.04563588155712     -0.07822326652899
            -0.02877176311425     -0.26686411844288
             0.29563588155712      0.60294901823636
             0.55754352622850     -0.26686411844287
             0.29563588155713     -0.07822326652899
            -0.02877176311425      0.01686411844287
            -0.04563588155712      0.02674875741081
             0                     0
             0                     0
             ];
        
        DD =  [        
              0                   0
              0                   0
              0.02674875741081    0
             -0.01686411844287    0
             -0.07822326652899    0.04563588155712
              0.26686411844288   -0.02877176311425
              0.60294901823636   -0.29563588155712
              0.26686411844287    0.55754352622850
             -0.07822326652899   -0.29563588155713
             -0.01686411844287   -0.02877176311425
              0.02674875741081    0.04563588155712
              0                   0
              ];  
        
        RR = 2*[ ...
             0                    0.02674875741081
             0                    0.01686411844287
            -0.04563588155712    -0.07822326652899
            -0.02877176311425    -0.26686411844288
             0.29563588155712     0.60294901823636
             0.55754352622850    -0.26686411844287
             0.29563588155713    -0.07822326652899
            -0.02877176311425     0.01686411844287
            -0.04563588155712     0.02674875741081
             0                    0
             0                    0
             0                    0
             ];
        Df{1} = [D(:,1) D(:,2)];  Df{2} = [DD(:,1) DD(:,2)];     
        Rf{1} = [R(:,1) R(:,2)];  Rf{2} = [RR(:,1) RR(:,2)];      
        
    otherwise
        try
            [LO_D,HI_D,LO_R,HI_R] = wfilters(name);
            Df = [LO_D' HI_D'];
            Rf = [LO_R' HI_R'];
        catch   %#ok<CTCH>
            msg = getWavMSG('Wavelet:moreMSGRF:Invalid_Wavelet',name);
            error(msg);
        end
end
if nargin <2
    varargout = {Df,Rf};
else
    if     isequal(lower(type),'d') , varargout = {Df};
    elseif isequal(lower(type),'r') , varargout = {Rf};
    else   varargout = {Df,Rf};
    end
end