上篇博文:【 MATLAB 】信号处理工具箱之fft简介及案例分析介绍了MATLAB信号处理工具箱中的信号变换 fft 并分析了一个案例,就是被噪声污染了的信号的频谱分析。

这篇博文继续分析几个小案例:

Gaussian Pulse

这个案例是将高斯脉冲从时域变换到频域,高斯脉冲的信息在下面的程序中都有注释:

clc
clear
close all
% Convert a Gaussian pulse from the time domain to the frequency domain.
%
% Define signal parameters and a Gaussian pulse, X.Fs = 100;           % Sampling frequency
t = -0.5:1/Fs:0.5;  % Time vector
L = length(t);      % Signal lengthX = 1/(4*sqrt(2*pi*0.01))*(exp(-t.^2/(2*0.01)));
% Plot the pulse in the time domain.
figure();
plot(t,X)
title('Gaussian Pulse in Time Domain')
xlabel('Time (t)')
ylabel('X(t)')% To use the fft function to convert the signal to the frequency domain,
% first identify a new input length that is the next power of 2 from the original signal length.
% This will pad the signal X with trailing zeros in order to improve the performance of fft.n = 2^nextpow2(L);
% Convert the Gaussian pulse to the frequency domain.
%
Y = fft(X,n);
% Define the frequency domain and plot the unique frequencies.f = Fs*(0:(n/2))/n;
P = abs(Y/n);figure();
plot(f,P(1:n/2+1))
title('Gaussian Pulse in Frequency Domain')
xlabel('Frequency (f)')
ylabel('|P(f)|')

高斯脉冲在时域的图像:

高斯脉冲在频域的图像:

Cosine Waves

这个例子比较简单,就是不同频率的余弦波在时域以及频域的比较:

clc
clear
close all
% Compare cosine waves in the time domain and the frequency domain.
%
% Specify the parameters of a signal with a sampling frequency of 1kHz and a signal duration of 1 second.Fs = 1000;                    % Sampling frequency
T = 1/Fs;                     % Sampling period
L = 1000;                     % Length of signal
t = (0:L-1)*T;                % Time vector
% Create a matrix where each row represents a cosine wave with scaled frequency.
% The result, X, is a 3-by-1000 matrix. The first row has a wave frequency of 50,
% the second row has a wave frequency of 150, and the third row has a wave frequency of 300.x1 = cos(2*pi*50*t);          % First row wave
x2 = cos(2*pi*150*t);         % Second row wave
x3 = cos(2*pi*300*t);         % Third row waveX = [x1; x2; x3];
% Plot the first 100 entries from each row of X in a single figure in order and compare their frequencies.figure();
for i = 1:3subplot(3,1,i)plot(t(1:100),X(i,1:100))title(['Row ',num2str(i),' in the Time Domain'])
end% For algorithm performance purposes, fft allows you to pad the input with trailing zeros.
% In this case, pad each row of X with zeros so that the length of each row is the next higher power of 2 from the current length.
% Define the new length using the nextpow2 function.n = 2^nextpow2(L);
% Specify the dim argument to use fft along the rows of X, that is, for each signal.dim = 2;
% Compute the Fourier transform of the signals.Y = fft(X,n,dim);
% Calculate the double-sided spectrum and single-sided spectrum of each signal.P2 = abs(Y/L);
P1 = P2(:,1:n/2+1);
P1(:,2:end-1) = 2*P1(:,2:end-1);
% In the frequency domain, plot the single-sided amplitude spectrum for each row in a single figure.figure();
for i=1:3subplot(3,1,i)plot(0:(Fs/n):(Fs/2-Fs/n),P1(i,1:n/2))title(['Row ',num2str(i),' in the Frequency Domain'])
end

下图是频率为50Hz,150Hz以及300Hz的余弦波在时域的图像:

下图分别为其fft:

从频域图中可以清晰的看到它们的频率成分位于何处。

【 MATLAB 】信号处理工具箱之 fft 案例分析相关推荐

  1. 【 MATLAB 】信号处理工具箱之fft简介及案例分析

    目录 Syntax Description Y = fft(X) Y = fft(X,n) Y = fft(X,n,dim) Examples Noisy Signal Syntax Y = fft( ...

  2. MATLAB信号处理工具箱函数列表分类

    **现将MATLAB信号处理工具箱函数进行分组,便于记忆查询和长期回顾.(只解释基本用途,具体用法请在help目录下查询)** Waveform Generation(波形产生) chairp: 产生 ...

  3. matlab信号处理工具箱函数列表

    现将MATLAB信号处理工具箱函数进行分组,便于记忆查询和长期回顾.(只解释基本用途,具体用法请在help目录下查询) Waveform Generation(波形产生) chairp: 产生扫频余弦 ...

  4. matlab滤波器设计工具箱带阻滤波器,用matlab信号处理工具箱进行fir滤波器设计的三种方法...

    用matlab信号处理工具箱进行fir滤波器设计的三种方法 摘 要 介绍了利用 MATLAB 信号处理工具箱进行 FIR 滤波器设计的三种方法:程序设计法. FDATool 设计法和 SPTool 设 ...

  5. MATLAB智能算法30个案例分析pdf

    下载地址:网盘下载 MATLAB智能算法30个案例分析,ISBN:9787512403512,作者:史峰,王辉 等编著 下载地址:网盘下载 转载于:https://www.cnblogs.com/cf ...

  6. MATLAB智能算法30个案例分析.史峰等

    <MATLAB智能算法30个案例分析>是2011年由北京航空航天大学出版社出版的图书,作者是郁磊.史峰.王辉.胡斐- <MATLAB智能算法30个案例分析>是作者多年从事算法研 ...

  7. Matlab信号处理工具箱

    原文地址:http://blog.sina.com.cn/s/blog_701c05820100ns24.html 滤波器设计与分析: 滤波器 分析 abs 幅度 angle 相位 filternor ...

  8. MATLAB信号处理——信号与系统的分析基础(5)

    1-6 LTI(线性时不变系统)的时域分析 LTI具有4个基本性质:1.线性:2.时不变性:3.微分性:4.积分性,它可以用下面的线性常微分方程来描述.https://baike.baidu.com/ ...

  9. MATLAB信号处理——信号与系统的分析基础(1)

    1-1 信号的概念 信号是传递信息的函数,可以表示为一个或几个独立变量的函数.按照时间.幅值的连续与离散可以分为: (1)连续时间信号:时间连续,幅值可以连续也可以离散 (2)模拟信号:时间连续,幅值 ...

最新文章

  1. 机器学习(实战)facebook地址预测
  2. mysql 常见存储过程,MYSQL存储过程
  3. boot spring 解析csv_文件系统(02):基于SpringBoot框架,管理Xml和CSV文件类型-阿里云开发者社区...
  4. 生产订单成本的计划、控制和结算
  5. app_offline.htm 是确有其事
  6. 用AzureFunction开发最简单的Teams Bot
  7. DNN使用非80端口和总是跳转到http://localhost问题的解决
  8. Redis集群搭建笔记
  9. php下载文件与服务器有关吗,php 下载文件功能中下载后文件大小与服务器源文件大小不一致...
  10. Python笔记-函数装饰器
  11. 90后美少女如何过五关斩六将入职支付宝技术男团?
  12. linux添加和增大交换分区(swap)的方法
  13. 竞争神经网络与SOM神经网络及其在矿井突水水源判别的应用
  14. Tensorflow Lite人体姿势跟踪功能上线:基于PosNet的实时人体姿态估计
  15. EditText焦点自动带出软键盘问题
  16. 02.规划过程组表格-需求跟踪矩阵
  17. c++语言 xml数据绑定技术简介
  18. android 字体css样式,css字体设置
  19. 3DMAX卸载/完美解决安装失败/如何彻底卸载清除干净3DMAX各种残留注册表和文件的方法...
  20. 计算机断层CT检查肺部混浊,揪出早期肺癌 低剂量电脑断层检查

热门文章

  1. graphic头文件函数_graphics.h头文件详解
  2. vue input文本框中文字整体添加整体删除_揭秘神奇的PPT文本框,高手都喜欢这样的招数...
  3. MyEclipse在保存时总是building workspace,反应很慢
  4. jQuery 实现 select模糊查询 反射机制
  5. oracle 伪列访问序列,Oracle数据库对象,同义词、序列、视图、索引
  6. c语言弟弟的作业,教弟弟做作业作文500字
  7. 计算机内部使用什么方法技术,计算机内部使用什么技术
  8. 360全景html插件,jquery实现360度全景展示特效插件
  9. 智能车竞赛技术报告 | 智能车视觉 - 山东大学(威海) - 山魂五队
  10. 2021年春季学期-信号与系统-第一次作业参考答案-第六题