久久久久久久999_99精品久久精品一区二区爱城_成人欧美一区二区三区在线播放_国产精品日本一区二区不卡视频_国产午夜视频_欧美精品在线观看免费

 找回密碼
 立即注冊(cè)

QQ登錄

只需一步,快速開(kāi)始

搜索
查看: 1667|回復(fù): 2
打印 上一主題 下一主題
收起左側(cè)

請(qǐng)問(wèn)DSP中普通軟件鎖相環(huán)如何編寫(xiě)?

[復(fù)制鏈接]
跳轉(zhuǎn)到指定樓層
樓主
請(qǐng)問(wèn)DSP中普通軟件鎖相環(huán)如何編寫(xiě)?
分享到:  QQ好友和群QQ好友和群 QQ空間QQ空間 騰訊微博騰訊微博 騰訊朋友騰訊朋友
收藏收藏 分享淘帖 頂 踩
回復(fù)

使用道具 舉報(bào)

沙發(fā)
ID:155507 發(fā)表于 2022-8-18 19:33 | 只看該作者
源代碼在單個(gè)文件中預(yù)先提供,并對(duì)其操作進(jìn)行了完整描述。 編譯后,程序?qū)⑦\(yùn)行鎖相環(huán)的模擬,生成一個(gè)數(shù)據(jù)文件,該文件可以使用 Gnuplot 或 Octave 繪制。

  1. // simulate a phase-locked loop
  2. #include <stdio.h>
  3. #include <stdlib.h>
  4. #include <complex.h>
  5. #include <math.h>

  6. int main() {
  7.     // parameters
  8.     float        phase_offset     = 0.00f;  // carrier phase offset
  9.     float        frequency_offset = 0.30f;  // carrier frequency offset
  10.     float        wn               = 0.01f;  // pll bandwidth
  11.     float        zeta             = 0.707f; // pll damping factor
  12.     float        K                = 1000;   // pll loop gain
  13.     unsigned int n                = 400;    // number of samples

  14.     // generate loop filter parameters (active PI design)
  15.     float t1 = K/(wn*wn);   // tau_1
  16.     float t2 = 2*zeta/wn;   // tau_2

  17.     // feed-forward coefficients (numerator)
  18.     float b0 = (4*K/t1)*(1.+t2/2.0f);
  19.     float b1 = (8*K/t1);
  20.     float b2 = (4*K/t1)*(1.-t2/2.0f);

  21.     // feed-back coefficients (denominator)
  22.     //    a0 =  1.0  is implied
  23.     float a1 = -2.0f;
  24.     float a2 =  1.0f;

  25.     // print filter coefficients (as comments)
  26.     printf("#  b = [b0:%12.8f, b1:%12.8f, b2:%12.8f]\n", b0, b1, b2);
  27.     printf("#  a = [a0:%12.8f, a1:%12.8f, a2:%12.8f]\n", 1., a1, a2);

  28.     // filter buffer
  29.     float v0=0.0f, v1=0.0f, v2=0.0f;
  30.    
  31.     // initialize states
  32.     float phi     = phase_offset;   // input signal's initial phase
  33.     float phi_hat = 0.0f;           // PLL's initial phase
  34.    
  35.     // run basic simulation
  36.     unsigned int i;
  37.     float complex x, y;
  38.     printf("# %6s %12s %12s %12s %12s %12s\n",
  39.             "index", "real(x)", "imag(x)", "real(y)", "imag(y)", "error");
  40.     for (i=0; i<n; i++) {
  41.         // compute input sinusoid and update phase
  42.         x = cosf(phi) + _Complex_I*sinf(phi);
  43.         phi += frequency_offset;

  44.         // compute PLL output from phase estimate
  45.         y = cosf(phi_hat) + _Complex_I*sinf(phi_hat);

  46.         // compute error estimate
  47.         float delta_phi = cargf( x * conjf(y) );

  48.         // print results to standard output
  49.         printf("  %6u %12.8f %12.8f %12.8f %12.8f %12.8f\n",
  50.             i, crealf(x), cimagf(x), crealf(y), cimagf(y), delta_phi);

  51.         // push result through loop filter, updating phase estimate
  52.         v2 = v1;  // shift center register to upper register
  53.         v1 = v0;  // shift lower register to center register
  54.         v0 = delta_phi - v1*a1 - v2*a2; // compute new lower register

  55.         // compute new output
  56.         phi_hat = v0*b0 + v1*b1 + v2*b2;
  57.     }
  58.     return 0;
  59. }
復(fù)制代碼

liquid_pll_example.zip

3.18 KB, 下載次數(shù): 10

9_sithamparanathan.pdf

321.58 KB, 下載次數(shù): 8

abineau_dpll_analysis.pdf

557.39 KB, 下載次數(shù): 8

回復(fù)

使用道具 舉報(bào)

板凳
ID:123289 發(fā)表于 2022-8-19 11:31 | 只看該作者
需帶有鎖相環(huán)的芯片,才行。依芯片手冊(cè)操作。
回復(fù)

使用道具 舉報(bào)

本版積分規(guī)則

小黑屋|51黑電子論壇 |51黑電子論壇6群 QQ 管理員QQ:125739409;技術(shù)交流QQ群281945664

Powered by 單片機(jī)教程網(wǎng)

快速回復(fù) 返回頂部 返回列表
主站蜘蛛池模板: 亚洲一区二区在线电影 | 国产色在线| 亚洲天堂av网 | 男女爱爱福利视频 | 韩国主播午夜大尺度福利 | 久久精品97 | 一区二区中文字幕 | 欧美在线观看免费观看视频 | 在线观看国产www | 国产激情在线 | 狠狠骚| 玖玖久久 | 四虎永久免费黄色影片 | 91国内精精品久久久久久婷婷 | 国产精品中文在线 | www久久国产 | 亚洲欧美日韩精品久久亚洲区 | 蜜臀久久 | 综合天天久久 | 国产精品99久久久久久人 | 一区二区视频 | 99re6在线| 一区二区三区高清 | 逼逼视频| 91电影 | 欧美成人一区二区三区 | 亚洲国产视频一区 | 久久久天天 | 中文字幕第三页 | 91高清视频在线观看 | 欧美精品一区三区 | 亚洲精品黄色 | 91精品国产色综合久久 | 午夜一区二区三区视频 | 国产精品久久久久久久久久久久 | 久久精品欧美一区二区三区不卡 | 超碰操 | 欧美精品一 | 国产乱码高清区二区三区在线 | 国产一区二区免费 | 久久久精品一区 |