首页 > 编程知识 正文

matlab测试代码,matlab谐波分析程序代码

时间:2023-05-04 06:05:08 阅读:115709 作者:1449

% E5 % 89 % 8d % e9 % a2 % E6 % 9c % 89 % E5 % 81 % 9a % E8 % BF % 87 ADC % E6 % 80 % a7 % E8 % 83 % BD % E6 % b5 % 82b % EB % % a1 % 8c % E6 % 80 % a7 % E8 % 83 % BD % E5 % 88 % E6 % 9e % 90 % E3 % 82 % 0a 20 % E4 % b8 % e9 % 9d % a2 % 20 % 95 % E4 20 the % 20 ffollots % 20 % 2020 based % 20on % 20 coherent % 20 sampling % 20 criteria % 2c % 20 and % 0a % 20 % 25 computes % 20 SNR 0 reliable.% 20 this % 20 program % 20 may % 20g et % 20 altered % 20 without % 20 prior % 20 notor % 25 % 20 lican _ ADC _ test % 5 % 27 % 29 % 3b % 0a % 20 % 25 % 203 b % 0a % 20 % fclk % 3d input % 28 % 27 sampling % 20 % 20 % 28 MHz % 29 % 3f % 20 % a % 20 num pt % 3d % 3b % 0a % 20 fclk % 3d % 2f % 3b % 0a % 20 % 25 % 20 fclk % 20 _ data _ out.txt % 27 % 27 % 25 s % 27 % 2c % 27 % 25s % 27 % 29 % 27 % 3b % 25 % E4 % bb % a5 % E5 % ad % 97 % E7 % AC % a6 % E5 % BD % a2 % 20le _ data.txt % 27 % E5 % 88 % B6 % E8 % BD % AC % E5 % 8c % 96 % E4 % b8 % ba10 % E8 % BF % 9b % E5 % 88 % B6 % E6 % B0 % ef % BC % 25 % 2000 0 end % 0a % 20nt % 20is % 20 its % 20 length % 0a % 20 % 25 v1 %3ddlmread % 28 % 27f : %5c pelican _ ADC _ test %5cv JTAG 0 row % 20 vector % 0a % 20 code % 3d v1 % 27 % 3b % 0a % 20 % 25ww % 2020 input % 20 amplitude % 0a % 20if % 20 % 28 max % 28 code % pping % 20-% 20 check % 20 input % 20 amplitude % 21 % 27 % 29 % 3b % 0a % 20 end % 0a % 20 figure % 3b % 0a % 20 plot % 25 % 20l de % 27 % 29 % 3b % 0a % 20 dout % 3d code-3 % 200 sinusoidal % 20 input % 0a % 20 voltage % 3d dout.% 2f % 28 % 282 % 5枚举位9.%2ablackmanharris % 28 num pt % 29 % 3b % 20 % add % 20 minimum % 20-term % 20 blackman-harr ris % 20ut _ db % 3d % 2a log 3d max % 28 dout _ db % 25 % 20 % 20 num pt % 2f % 20 points % 20 spectrum % 0a % 20 % E8 % AE % a1 % E7 % AE % 97 % E8 % B7 % 9d % ude % 3d % 2a log 10 % 28 max _ voltage % 2f 0.5 % 29 % 3b % 20 % 25f % 20b : num pt % 2f-% 5d.% 2a fclk %2fnum pt % 2cd out _t 7 % 29 % 3b % 0a % 20x标签% 28 % 27a nalog % 20 input % 20 frequency % 20 % 28 MHz % 29 % 27 % 29 % 3b % 250 ylabel % 25

TUDE (dBfs)');

a1=axis; axis([a1() a1() - a1()]);

fin=find(Dout_dB(:numpt/)==maxdB); %Find the signal 难过的自行车 (DC represents 难过的自行车=)

DC_span=; %default DC leakage 难过的自行车s are 难过的自行车s

signal_span = ; %signal leakage 难过的自行车s are ± 难过的自行车s for minumun -term black-harris window

spanh=; %%default harmonic leakage 难过的自行车s are ± 难过的自行车s

spectP=(abs(Dout_spect)).*(abs(Dout_spect));

%Determine power level

Pdc=sum(spectP(:DC_span)); %Determine DC offset power level

Ps=sum(spectP(fin-signal_span:fin+signal_span)); %Determine signal power level

Fh=[];

%Vector storing frequency and power components of signal and harmonics

Ph=[]; %HD1=signal, HD2=2nd harmonic, HD3=3rd harmonic, etc.

%Find the harmonic frequencies/power within the FFT plot

for har_num=:

tone=rem((har_num*(fin- )+)/numpt,); %Note: tones > fSAMPLE are aliased back

if tone>0.5

tone=-tone;

end

Fh=[Fh tone];

%For this method to work properly, make sure that the folded back high order harmonics do not overlap with DC and signal

%components or lower order harmonics.

har_peak=max(spectP(round(tone*numpt)-spanh:round(tone*numpt)+spanh));

har_难过的自行车=find(spectP(round(tone*numpt)-spanh:round(tone*numpt)+spanh)==har_peak);

har_难过的自行车=har_难过的自行车+round(tone*numpt)-spanh- ; %make sure that the folded back high order harmonics do not overlap with DC and signal components or lower order harmonics

Ph=[Ph sum(spectP(har_难过的自行车-:har_难过的自行车+))];

end

Pd=sum(Ph(:)); %Total distortion power level

Pn=sum(spectP(:numpt/))-Pdc-Ps-Pd; %Extract noise power level

format;

A=(max(code)-min(code))/(^numbit) %Analog input amplitude in mV

AdB=*log10(A) %Analog input amplitude in dB

SNR=*log10(Ps/Pn) %SNR in dB

SINAD=*log10(Ps/(Pn+Pd)) %SINAD in dB

disp('THD - HD2 through HD9');

THD=*log10(Pd/Ph()) %THD in dB

SFDR=*log10(Ph()/max(Ph(:))) %SFDR in dB

disp('SIGNAL AND HARMONIC POWER (dB)');

HD=*log10(Ph(:)/Ph())

hold on;

plot(Fh()*fclk,-,'bo',Fh()*fclk,-,'bx',Fh()*fclk,-,'b+',Fh()*fclk,-,'b*',Fh()*fclk,-,'bs',Fh()*fclk,-,'bd',Fh()*fclk,-,'bv',Fh()*fclk,-,'b^');

legend('SIGNAL','HD2','HD3','HD4','HD5','HD6','HD7','HD8','HD9');

hold off;

输出结果

A =

0.5432

AdB =

-5.3006

SNR =

54.0005

SINAD =

53.4240

THD - HD2 through HD9

THD =

-62.4784

SFDR =

63.0618

SIGNAL AND HARMONIC POWER (dB)

HD =

-63.0618 -78.1190 -79.6691 -82.4058 -86.1153 -90.7795 -91.1868 -89.8460 -74.6853

会标记出谐波的位置。

如何加速MATLAB代码运行

学习笔记 V1.0 2015/4/17 如何加速MATLAB代码运行 概述 本文源于LDPCC的MATLAB代码,即.由于代码的问题,在信息位长度很长 ...

SVM实例及Matlab代码

******************************************************** ***数据集下载地址 :http://pan.baidu.com/s/1geb8CQf ...

测试C++代码与WebBrowser HTML的互动

testWebBrowserDlg.h // testWebBrowserDlg.h : 头文件 // #pragma once #include "explorer1.h" #i ...

多分类问题中,实现不同分类区域颜色填充的MATLAB代码(demo:Random Forest)

之前建立了一个SVM-based Ordinal regression模型,一种特殊的多分类模型,就想通过可视化的方式展示模型分类的效果,对各个分类区域用不同颜色表示.可是,也看了很多代码,但基本都是 ...

卷积相关公式的matlab代码

取半径=3 用matlab代码实现上式公式: length=3;for Ki = 1:length for Kj = 1:length for Kk = 1:length Ksigma(Ki,Kj,K ...

使用JUnit测试java代码

Junit 单元测试实验报告  一.实验环境 MyEclipse2014.Junit4.10 二.实验目的 学会单元测试,在MyEclipse中进行Junit测试 三.实验步骤 1.写出要测试的类 代 ...

JAVA调用matlab代码

做实验一直用的matlab代码,需要嵌入到java项目中,matlab代码拼拼凑凑不是很了解,投机取巧采用java调用matlab的方式解决. 1.    matlab版本:matlabR2014a ...

前端测试框架Jest系列教程 -- Asynchronous(测试异步代码)

写在前面: 在JavaScript代码中,异步运行是很常见的.pgyz有异步运行的代码时,Jest需要知道它测试的代码何时完成,然后才能继续进行另一个测试.Jest提供了几种方法来处理这个问题. 测试异步 ...

调试和运行matlab代码(源程序)的技巧和教程

转载请标明出处:专注matlab代码下载的网站http://www.downma.com/ 本文主要给大家分享使用matlab编写代码,完成课程设计.毕业设计或者研究项目时,matlab调试程序的技巧 ...

随机推荐

调试关于Hibernate的程序遇到的问题

最怕的就是初学一些东西,低级的错误犯了又犯,现在总结出来以便以后不要再犯类似的错误. 一.Hibernate的延迟加载机制 在用hibernate底层访问数据库的过程忽略了延迟加载机制导致 在访问时候 ...

Centos6.5更新e1000网卡驱动

导读 在工作过程中经常遇到linux的操作系统网络不正常的情况,以前没有注意到,今天查看系统日志发现原来是网络驱动的问题.索性直接更新系统,更新网卡 问题:linux系统经常出现断网的情况,重启之后系 ...

查看Linux硬件配置信息

在网上找了N久,发现了一篇不错的文档,转载一下: 1.查看机器所有硬件信息: dmidecode |more dmesg |more 这2个命令出来的信息都非常多,所以建议后面使用"|mor ...

Android中Universal Image Loader开源框架的简单使用

UIL (Universal Image Loader)aims to provide a powerful, flexible and highly customizable instrument ...

pollard_rho和Miller_Ra难过的自行车

Miller_Ra难过的自行车就是以概论大小来判断素数 可以判断2^63范围的数 pollard_rho推荐两个很好的博客来理解:整数分解费马方法以及Pollard rho和[ZZ]Pollard Rho算 ...

php正则表达式总结

<?php echo 'wj'; echo '
'; $file = '

移动150卡

版权声明:该文观点仅代表作者本人。处理文章:请发送邮件至 三1五14八八95#扣扣.com 举报,一经查实,本站将立刻删除。