当前位置:网站首页>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');

边栏推荐
- Resources reads 2D texture and converts it to PNG format
- 在连接mysql数据库的时候一直报错
- bedtools使用教程
- Programmer growth Chapter 6: how to choose a company?
- Industry analysis
- 【多线程】主线程等待子线程执行完毕在执行并获取执行结果的方式记录(有注解代码无坑)
- How to Create a Beautiful Plots in R with Summary Statistics Labels
- Compilation errors and printout garbled problems caused by Chinese content in vs2019 code
- YYGH-10-微信支付
- Visualization of chip SEQ data by deeptools
猜你喜欢

动态内存(进阶四)

How to Easily Create Barplots with Error Bars in R

Map set assignment to database

Eight sorting summaries

JS -- take a number randomly from the array every call, and it cannot be the same as the last time

GGPUBR: HOW TO ADD ADJUSTED P-VALUES TO A MULTI-PANEL GGPLOT

Flesh-dect (media 2021) -- a viewpoint of material decomposition

6方面带你认识LED软膜屏 LED软膜屏尺寸|价格|安装|应用

PowerBI中导出数据方法汇总

RPA进阶(二)Uipath应用实践
随机推荐
Map set assignment to database
对毕业季即将踏入职场的年轻人的一点建议
在连接mysql数据库的时候一直报错
Amazon cloud technology community builder application window opens
原生方法合并word
GGPlot Examples Best Reference
Seriation in R: How to Optimally Order Objects in a Data Matrice
Liftover for genome coordinate conversion
时间格式化显示
STM32 single chip microcomputer programming learning
Take you ten days to easily finish the finale of go micro services (distributed transactions)
Mmrotate rotation target detection framework usage record
PYQT5+openCV项目实战:微循环仪图片、视频记录和人工对比软件(附源码)
Bedtools tutorial
On April 17, 2022, the five heart matchmaker team received double good news
抖音海外版TikTok:正与拜登政府敲定最终数据安全协议
File operation (detailed!)
Is the Ren domain name valuable? Is it worth investing? What is the application scope of Ren domain name?
YYGH-10-微信支付
Cmake cross compilation