⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 sviplot3.m

📁 数字通信第四版原书的例程
💻 M
字号:
    function   aaa = sviplot3(input, pre_state, expe, aft_state);

%This function is only used by Call back MATLAB from C-mex funcitons sviterbi.c 
%  Copyright (c) 1996 The MathWorks, Inc.
%  All Rights Reserved
% See also sviplot1, sviplot2, sviplot3

    % only for mexFunction 'sviterbi' callMATLAB.
    M = input(1);
    trace_num = input(2);
    expen_flag = input(3);
    fig_position = input(4);
    trace_flag = input(5);
    leng = input(6);

    handles = get(input(7), 'UserData');
    aaa = max(find(pre_state~=0));
    pre_state = pre_state(1:aaa);
    bbb = max(find(aft_state~=0));
    aft_state = aft_state(1:bbb);

    num_state = M;
    n_std_sta = 2^M;
    PowPowM = n_std_sta^2;
    expense = zeros(leng, PowPowM);
    for i=1:PowPowM
        expense(:,i) = expense(:,i) + expe(1+(i-1)*leng:leng+(i-1)*leng);
    end;

    plot_curv_x = [get(handles(2), 'XData'), NaN, -fig_position, NaN];
    plot_curv_y = [get(handles(2), 'YData'), NaN, -1000, NaN];
    dot_x = get(handles(4), 'XData');
    dot_y = get(handles(4), 'YData');

    % plot only; no computation function here.
    flipped = zeros(1, n_std_sta);
    for i = 1 : n_std_sta 
        flipped(i) =  bi2de(fliplr(de2bi(i-1, M)));
    end;
    for j2 = 1 : length(pre_state)
        jj = pre_state(j2) - 1;
        for j = 1 : n_std_sta
            tmp = expense(trace_num, (j-1)*n_std_sta+1: j*n_std_sta);
            if expen_flag
                expen_rec(j) = max(tmp(find(~isnan(tmp))));
            else
                expen_rec(j) = min(tmp(find(~isnan(tmp))));
            end;
            for j2 = 1 : length(tmp)
                if ~isnan(tmp(j2))
                    plot_curv_x = [plot_curv_x, fig_position-1+.1, fig_position, NaN];
                    plot_curv_y = [plot_curv_y, flipped(j2), flipped(j), NaN];
                end;
            end;
        end;
    end;
    for j2 = 1 : length(aft_state)
        jj = aft_state(j2) - 1;
        set(handles(jj+5), 'Position', [fig_position, bi2de(fliplr(de2bi(jj,num_state))), 0],...
           'String',  num2str(expen_rec(jj+1)));
        tmp = get(handles(jj+5), 'Position');
        dot_x = [dot_x, tmp(1)];
        dot_y = [dot_y, tmp(2)];
    end;

    set(handles(2), 'XData', plot_curv_x, 'YData', plot_curv_y);
    set(handles(4), 'XData', dot_x, 'YData', dot_y);
    if ~trace_flag
   %     drawnow;
    end;
    % end of sviplot4.m


⌨️ 快捷键说明

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