getubar2.m

来自「Continuous Profile Models (CPM) Matlab T」· M 代码 · 共 32 行

M
32
字号
% function ubar = getUbar2(G,u)%% returns u bar for each class, size(ubar)=1,G.numClassfunction ubar = getUbar2(G,u)%% too slow to keep this here% if ~exist('u')  %% need this indirectly for uFunction%     u=G.u;% endif G.useBalancedPenalty    ubar=zeros(1,G.numClass);    if ~G.USE_CPM2              for cc=1:G.numClass            tmpInd = G.class{cc};            ubar(cc)=sum(u(tmpInd).^2)/length(tmpInd);        end    else        %% average over control point values, which are stored        %% in u now                    for cc=1:G.numClass            tmpInd = G.class{cc};            ctrlPtVals = u(tmpInd,:);            ubar(cc)=mean(ctrlPtVals(:).^2);        end            endelse    ubar=ones(1,G.numClass);end

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?