<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                ThinkChat2.0新版上線,更智能更精彩,支持會話、畫圖、視頻、閱讀、搜索等,送10W Token,即刻開啟你的AI之旅 廣告
                ```c++ // 0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0 const int asinTable[]={ 0, 5, 11, 17, 23, 30, 36, 44, 53, 64, 90 }; //0-90度反余弦表 #define HLTC_ABS(x) (x>=0? x : -x) //定義絕對值宏 /************************************* * 函數:HLTC_CalPhaseTable * 功能:查找表計算相位 * @param1:歸一化后的幅度 -HLTC_AMP ~ HLTC_AMP * 返回值:量化的相位 ************************************/ int HLTC_CalPhaseTable(int a){ if(a > HLTC_AMP) return 0; if(a < -HLTC_AMP ) return 0; int rt = 0; int temp=HLTC_ABS(a); int tDown = temp*10/HLTC_AMP; if(temp==HLTC_AMP) return (a>=0) ? asinTable[tDown] : -asinTable[tDown]; int tUp = tDown + 1 ; rt = (asinTable[tUp] - asinTable[tDown])*(temp-tDown*HLTC_AMP/10)/(HLTC_AMP/10) + asinTable[tDown]; //計算相位值 rt = (a>=0) ? rt : -rt ; return rt; } /******************************************************** * 函數:HLTC_CalPhaseD * 功能:量化相位差 +:相位超前 -:相位滯后 * @param1:歸一化后的正弦信號幅度 最大值 HLTC_AMP * @param2:信號相對于與上一次數據的變化趨勢 1:遞增 0 :遞減 * @param3:歸一化后的參考正弦信號幅度 最大值 HLTC_AMP * @param4:參考信號相對于與上一次數據的變化趨勢 1:遞增 0 :遞減 * 返回值:量化的相位差 *******************************************************/ #define HLTC_PHASE_REAL int HLTC_CalPhaseD(int a,int dir,int aRef,int dirRef){ #ifdef HLTC_PHASE_REAL //查找表插值量化 int rt=0; int t1 = 0; int t2 = 0; int tRef; if(dirRef == 1){ if(dir == 1) { // 1,1 rt = HLTC_CalPhaseTable(a) - HLTC_CalPhaseTable(aRef); } else { // 1,0 tRef = HLTC_CalPhaseTable(aRef); int tmp = HLTC_CalPhaseTable(a); if( a >= 0 ) t1 = 90 + (90-tmp) ; else t1 = 180 - tmp; t2 = t1 - 360; int tDiff = (t1 - tRef) - (tRef - t2 ) ; if(tDiff >0 ) rt = t2 - tRef; else rt = t1 - tRef; } } else { if( dir ==0 ){ tRef = 180 - HLTC_CalPhaseTable(aRef); t1 = 180 - HLTC_CalPhaseTable(a); rt = t1 - tRef ; } else { tRef = 180 - HLTC_CalPhaseTable(aRef); t1 = HLTC_CalPhaseTable(a); t2 = t1 + 360 ; int tDiff = (tRef -t1 ) - (t2 - tRef ) ; if(tDiff >0 ) rt = t2 - tRef; else rt = t1 - tRef; } } return rt; #else //比值量化相位 int rt=0; int tRef = 0 ; int t1 = 0;//信號的可能位置1 int t2 = 0;//信號的可能位置2 if(dirRef == 1 ) { //參考信號在遞增區域 if(dir == 1){ //都在遞增區域 rt = a - aRef ; // +:信號超前 -:信號滯后 0:信號同向 } else{ //參考遞增,信號遞減 //計算參考信號的位置 tRef = aRef; if( a >= 0 ) t1 = HLTC_AMP + (HLTC_AMP-a) ; else t1 = (HLTC_AMP<<1) - a ; // 200 - a t2 = t1 - (HLTC_AMP<<2); //t1 - 400 int tDiff = (t1 - tRef) - (tRef - t2 ) ; if(tDiff >=0 ){ rt = t2 - tRef; } else rt = t1 - tRef; } } else { //參考信號在遞減區 if(dir == 0 ) { // down rt = aRef - a ; } else { //up tRef = -aRef; t1 = (HLTC_AMP<<1) + a; // 200 + a t2 = t1 - (HLTC_AMP<<2); // t1 - 400 int tDiff = (t1 - tRef) - (tRef - t2 ) ; if(tDiff >=0 ){ rt = t2 - tRef; } else rt = t1 - tRef; } } return rt; #endif } ``` 使用對相位精度不是很高的場合,可以依據這個實現同頻信號的相位PID控制。
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看