当前位置:网站首页>Power Spectral Density Estimates Using FFT---MATLAB
Power Spectral Density Estimates Using FFT---MATLAB
2022-07-02 11:49:00 【Xiaoyu 2022】
% Power Spectral Density Estimates Using FFT
% pr8_2_1
clear all; clc; close all;
randn('state',0); % Random number initialization
Fs = 1000; % sampling frequency
t = 0:1/Fs:1-1/Fs; % Time scale
f1=50; f2=120; % Frequency of two sinusoidal components
x=cos(2*pi*f1*t)+3*cos(2*pi*f2*t)+randn(size(t)); % The signal
% Use FFT
N = length(x); % x length
xdft = fft(x); % FFT
xdft = xdft(1:N/2+1); % Positive frequency
psdx = (1/(Fs*N)) * abs(xdft).^2; % Calculate the power spectral density
psdx(2:end-1) = 2*psdx(2:end-1); % ride 2(2:end-1)
freq = 0:Fs/length(x):Fs/2; % Frequency scale
subplot 211
plot(freq,10*log10(psdx),'k') % Take logarithm to plot
grid on; xlim([0 Fs/2]);
title(' use FFT Periodic graph of ')
xlabel(' frequency /Hz')
ylabel(' Power spectral density /(dB/Hz)')
% call periodogram function
[Pxx,f]=periodogram(x,rectwin(length(x)),N,Fs);
subplot 212
plot(freq,10*log10(Pxx),'k'); % Take logarithm to plot
grid on; xlim([0 Fs/2]);
title(' call periodogram Periodic graph of function ')
xlabel(' frequency /Hz')
ylabel(' Power spectral density /(dB/Hz)')
mxerr = max(psdx'-Pxx) % Find the maximum difference between the two methods
set(gcf,'color','w');

边栏推荐
- easyExcel和lombok注解以及swagger常用注解
- 揭露数据不一致的利器 —— 实时核对系统
- to_ Bytes and from_ Bytes simple example
- FLESH-DECT(MedIA 2021)——一个material decomposition的观点
- MySql存储过程游标遍历结果集
- Principe du contrat évolutif - delegatecall
- 6. Introduce you to LED soft film screen. LED soft film screen size | price | installation | application
- Data analysis - Matplotlib sample code
- 数据分析 - matplotlib示例代码
- Visualization of chip SEQ data by deeptools
猜你喜欢

基于Hardhat和Openzeppelin开发可升级合约(一)

在连接mysql数据库的时候一直报错

亚马逊云科技 Community Builder 申请窗口开启

Principle of scalable contract delegatecall

Attribute acquisition method and operation notes of C # multidimensional array

制造业数字化转型和精益生产什么关系

数据分析 - matplotlib示例代码

C#多维数组的属性获取方法及操作注意

Never forget, there will be echoes | hanging mirror sincerely invites you to participate in the opensca user award research

excel表格中选中单元格出现十字带阴影的选中效果
随机推荐
File operation (detailed!)
YYGH-10-微信支付
Cluster Analysis in R Simplified and Enhanced
R HISTOGRAM EXAMPLE QUICK REFERENCE
php 二维、多维 数组打乱顺序,PHP_php打乱数组二维数组多维数组的简单实例,php中的shuffle函数只能打乱一维
Mmrotate rotation target detection framework usage record
Beautiful and intelligent, Haval H6 supreme+ makes Yuanxiao travel safer
How to Visualize Missing Data in R using a Heatmap
对毕业季即将踏入职场的年轻人的一点建议
基于 Openzeppelin 的可升级合约解决方案的注意事项
Native method merge word
Principe du contrat évolutif - delegatecall
Redis超出最大内存错误OOM command not allowed when used memory > 'maxmemory'
How to Create a Nice Box and Whisker Plot in R
MySQL比较运算符IN问题求解
Order by注入
Compilation errors and printout garbled problems caused by Chinese content in vs2019 code
Redis exceeds the maximum memory error oom command not allowed when used memory & gt; ' maxmemory'
PX4 Position_Control RC_Remoter引入
Amazon cloud technology community builder application window opens