Code covered by the BSD License  

Highlights from
Hybrid Genetic Optimizer for Grey-box Model Identification

Hybrid Genetic Optimizer for Grey-box Model Identification

by

 

Matlab code of a hybrid genetic optimizer for Grey-box Model Identification.

Avg_Func(S21_RI, Opt)
function [S21_RI_Avg] = Avg_Func(S21_RI, Opt)
% MAT(Freq,Pwr):        avg of all COL/Pwr
%       Row-VEC         avg of all COL/Pwr
%       Col-VEC      	keep as it is
% Row-Col-VEC + Opt.Dim='VEC': 	REshaped to avg along COL/Pwr
%
% RI_Avg + dB_Avg:  give similar results

switch Opt.Dim
    case{'VEC'}% REshaped to avg along COL/Pwr
        if isvector(S21_RI)% Row-Col-VEC
            if (DimFlip_Func(S21_RI) == 1)% Col-VEC
                S21_RI = reshape(S21_RI,1,[]);
            end
        else
            disp(' input is NOT Vector')
            pause
        end
    case{'MAT'}% MAT(Freq,Pwr)
end

PWR_STOP = size(S21_RI, 2);
%% ########################### Pre Proc
switch Opt.RIdB
	%----------------------------------------------
	case{'RI'}
        x = S21_RI;
	%----------------------------------------------
	case{'dB'}
        x = Lin2dB_dB( S21_RI );
end

%% ########################### Avg
    x_Avg = 0;
for PWR = 1 : PWR_STOP
    x_Avg = x_Avg + x(:,PWR);
end
    x_Avg = x_Avg / PWR_STOP;
    
%% ########################### Post Proc
switch Opt.RIdB
	%----------------------------------------------
	case{'RI'}
        S21_RI_Avg = x_Avg;
	%----------------------------------------------
	case{'dB'}
        S21_RI_Avg = dB2Lin_RI( x_Avg );
end

%% Test
if(0)
    

end

Contact us