资源简介

根据每一星座点临近星座点距其距离判断颜色;颜色越红,距离越近;

资源截图

代码片段和文件信息

function Get_Color_Constellation(wavein)
    N = 4;
    Nbeside = 20;%左右两侧共2*Nbeside个点
    indexdata = zeros(length(wavein)N);
    angledata = linspace(0pi/2N);
    for m = 1:N
        data = real(exp(1j*angledata(m)))*real(wavein)+...
            imag(exp(1j*angledata(m)))*imag(wavein);
        [~sortdata] = sort(data); 
        indexdata(:m) = sortdata;
    end
    dis = zeros(length(indexdata)N);
    for kk = 1:N
        for k = 1:length(indexdata)
            indexbeg = k-Nbeside;
            if indexbeg < 1
                indexbeg = 1;
            end
            indexend = indexbeg+Nbeside*2+1;
            if indexend > length(data)
                indexend = length(data);
                indexbeg = length(data)-2*Nbeside;
            end  
            datatemp = wavein(indexdata(indexbeg:indexendkk))-wavein(indexdata(kkk));
            [t1t2]=sort(abs(datatemp));
            dis(indexdata(kkk)kk) = t1(2);
        e

评论

共有 条评论