从网上看到的,值得收藏一下。
在使用matlab进行信号处理和图形绘制过程中,某些函数被频繁调用,所以有必要将这些常用函数进行总结归类。滤波函数低通滤波function [filtered_signal,filtb,filta]=lopass_butterworth(inputsignal,cutoff_freq,Fs,order)
% Low-pass Butterworth filter
% [filtered_signal,filtb,filta] = lopass_butterworth(inputsignal,cutoff_freq,Fs,order)
%
% This is simply a set of built-in Matlab functions, repackaged for ease of
% use by Chad Greene, October 2012.
%
% INPUTS:
% inputsignal = input time series
% cutoff_freq = filter corner frequency
% Fs = data sampling frequency
% order = order of Butterworth filter
%
% OUTPUTS:
% filtered_signal = the filtered time series
% filtb, filta = filter numerator and denominator (optional)
%
% EXAMPLE 1:
% load train
% t = (1:length(y))/Fs;
% y_filt = lopass_butterworth(y,900,Fs,4); % cut off at 900 Hz
% figure
% plot(t,y,‘b’,t,y_filt,‘r’)
% xlabel(‘time in seconds’)
% box off
% legend(‘unfiltered’,‘filtered’)
% sound(y,Fs) % play original time series
% pause(2) % pause two seconds
% sound(y_filt,Fs) % play filtered time series

nyquist_freq = Fs/2; % Nyquist frequency
Wn=cutoff_freq/nyquist_freq; % non-dimensional frequency
[filtb,filta]=butter(order,Wn,‘low’); % construct the filter
filtered_signal=filtfilt(filtb,filta,inputsignal); % filter the data with zero phase
高通滤波function [filtered_signal,filtb,filta]=hipass_butterworth(inputsignal,cutoff_freq,Fs,order)
% High-pass Butterworth filter
% [filtered_signal,filtb,filta] = hipass_butterworth(inputsignal,cutoff_freq,Fs,order)
%
% This is simply a set of built-in Matlab functions, repackaged for ease of
% use by Chad Greene, October 2012.
%
% INPUTS:
% inputsignal = input time series
% cutoff_freq = filter corner frequency
% Fs = data sampling frequency
% order = order of Butterworth filter
%
% OUTPUTS:
% filtered_signal = the filtered time series
% filtb, filta = filter numerator and denominator (optional)
%
% EXAMPLE 1:
% load train
% t = (1:length(y))/Fs;
% y_filt = hipass_butterworth(y,900,Fs,4); % cut off at 900 Hz
% figure
% plot(t,y,‘b’,t,y_filt,‘r’)
% xlabel(‘time in seconds’)
% box off
% legend(‘unfiltered’,‘filtered’)
% sound(y,Fs) % play original time series
% pause(2) % pause two seconds
% sound(y_filt,Fs) % play filtered time series

nyquist_freq = Fs/2; % Nyquist frequency
Wn=cutoff_freq/nyquist_freq; % non-dimensional frequency
[filtb,filta]=butter(order,Wn,‘high’); % construct the filter
filtered_signal=filtfilt(filtb,filta,inputsignal); % filter the data with zero phase
带通滤波function [filtered_signal,filtb,filta]=bandpass_butterworth(inputsignal,cutoff_freqs,Fs,order)
% Bandpass Butterworth filter
% [filtered_signal,filtb,filta] = bandpass_butterworth(inputsignal,cutoff_freq,Fs,order)
%
% This is simply a set of built-in Matlab functions, repackaged for ease of
% use by Chad Greene, October 2012.
%
% INPUTS:
% inputsignal = input time series
% cutoff_freqs = filter corner frequencies in the form [f1 f2]
% Fs = data sampling frequency
% order = order of Butterworth filter
%
% OUTPUTS:
% filtered_signal = the filtered time series
% filtb, filta = filter numerator and denominator (optional)
%
% EXAMPLE 1:
% load train
% t = (1:length(y))/Fs;
% y_filt = bandpass_butterworth(y,[800 1000],Fs,4); % cut off below 800 Hz and above 1000 Hz
%
% figure
% plot(t,y,‘b’,t,y_filt,‘r’)
% xlabel(‘time in seconds’)
% box off
% legend(‘unfiltered’,‘filtered’)
% sound(y,Fs) % play original time series
% pause(2) % pause two seconds
% sound(y_filt,Fs) % play filtered time series

nyquist_freq = Fs/2; % Nyquist frequency
Wn=cutoff_freqs/nyquist_freq; % non-dimensional frequency
[filtb,filta]=butter(order,Wn,‘bandpass’); % construct the filter
filtered_signal=filtfilt(filtb,filta,inputsignal); % filter the data with zero phase
带阻滤波function [filtered_signal,filtb,filta]=bandstop_butterworth(inputsignal,cutoff_freqs,Fs,order)
% Band-stop Butterworth filter
% [filtered_signal,filtb,filta] = bandstop_butterworth(inputsignal,cutoff_freqs,Fs,order)
%
% This is simply a set of built-in Matlab functions, repackaged for ease of
% use by Chad Greene, October 2012.
%
% INPUTS:
% inputsignal = input time series
% cutoff_freqs = filter corner frequencies in the form [f1 f2]
% Fs = data sampling frequency
% order = order of Butterworth filter
%
% OUTPUTS:
% filtered_signal = the filtered time series
% filtb, filta = filter numerator and denominator (option 大专栏 Matlab - 常用函数集锦al)
%
% EXAMPLE 1:
% load train
% t = (1:length(y))/Fs;
% y_filt = bandstop_butterworth(y,[800 1000],Fs,4); % cut off below 800 Hz and above 1000 Hz
%
% figure
% plot(t,y,‘b’,t,y_filt,‘r’)
% xlabel(‘time in seconds’)
% box off
% legend(‘unfiltered’,‘filtered’)
% sound(y,Fs) % play original time series
% pause(2) % pause two seconds
% sound(y_filt,Fs) % play filtered time series

nyquist_freq = Fs/2; % Nyquist frequency
Wn=cutoff_freqs/nyquist_freq; % non-dimensional frequency
[filtb,filta]=butter(order,Wn,‘stop’); % construct the filter
filtered_signal=filtfilt(filtb,filta,inputsignal); % filter the data with zero phase
绘图函数function [ ] = setPlot( varargin )
% setPlot()
% setPlot(title)
% setPlot(title,xlabel)
% setPlot(title,xlable,ylabel)
% setPlot(title,xlabel,ylabel,xlim)
% setPlot(title,xlable,ylabel,xlim,ylim)

narginchk(0,5); % 判断输入参数是否足够

grid on;
axis tight;

if nargin>=1
title(varargin{1});
end

if nargin>=2
xlabel(varargin{2});
end

if nargin>=3
ylabel(varargin{3});
end

if nargin>=4
xlim(varargin{4});
end

if nargin>=5
ylim(varargin{5});
end

end
信号处理函数频谱分析function [freq,amp]=fft_signal(signal,fs,N)
% Spectrum analysis
% INPUTS:
% signal = input time series
% fs = data sampling frequency
% N = data length of signal
%
% OUTPUTS:
% freq = frequency of Spectrum
% amp = amplitude of Spectrum
%
% EXAMPLE 1:
% fs = 100;
% N = fs10;
% t = (0:N-1)/fs;
% y = sin(2
pi10t);
% [freq,amp] = fft_signal(y,fs,N);
% plot(freq,amp);

amp = 2*abs(fft(signal))/N; % 求取信号的幅度谱
amp = amp(1:fix(length(amp)/2)); % 截取有效部分
freq=(0:length(amp)-1)fs/N; % 横坐标代表频率
end
幅值分布function [ amp,dist ] = ampDist( signal,sectionNum )
% Calculate the amplitude distribution of the signal
% INPUTS:
% signal : The signal to be analyzed
% sectionNum : Number of segments
%
% OUTPUTS:
% amp : Amplitude after segmentation
% dist :Amplitude distribution
%
% EXAMPLE 1:
% fs = 1000;
% N = fs
100;
% y = wgn(1,N,10); % 高斯白噪声
% [amp,dist] = ampDist(y,500);
% bar(amp,dist);

yMin = min(signal);
yMax = max(signal);

amp = linspace(yMin,yMax,sectionNum);
dist = hist(signal,amp);
dist = dist./length(signal);
end
LMS最小均方算法function [ y_error, y_filter ] = LMS( x_input,x_dest,M,u )
% LMS 最小均方算法
% INPUTS:
% x_input 原始信号
% x_dest 期望信号
% M 阶次
% u 步长因子
%
% OUTPUTS:
% y_error 误差信号
% y_filter 滤波器信号输出
%
% EXAMPLE 1:
% load train
% t = (1:length(y))/Fs;
% M = 2; u = 0.5;
% y_dest = (max(y)-min(y))/2cos(2pi18t); % 参考信号
% [y_error,y_filter] = LMS(y,y_dest,M,u);
% plot(t,y_error,t,y_filter);

N = length(x_input);
y_filter = zeros(1,N);
y_error = zeros(1,N);
h = zeros(1,M);

for k=M:N
h_old = h;
y_filter(k) = x_dest(k?k-M+1)h_old’;
y_error(k) = x_input(k) - y_filter(k);
h = h_old + 2
u*y_error(k)*x_dest(k?k-M+1);
end

end
EMD经验模态分解function imf = emd(x)
% Empiricial Mode Decomposition (Hilbert-Huang Transform)
% imf = emd(x)
% Funcs : ismonotonic, isimf, getspline, findpeaks

x = transpose(x(?); % 将x变为一维向量
imf = [];
while ~ismonotonic(x)
x1 = x;
sd = Inf;
cnt=0;
while (sd > 0.1) || ~isimf(x1)
s1 = getspline(x1);
s2 = -getspline(-x1);
x2 = x1-(s1+s2)/2;

  sd = sum((x1-x2).^2)/sum(x1.^2);x1 = x2;cnt=cnt+1;

end
% cnt

imf{end+1} = x1;
x = x-x1;
end
imf{end+1} = x;

% FUNCTIONS
% 判断信号的单调性
function u = ismonotonic(x)

u1 = length(findpeaks(x))*length(findpeaks(-x));
if u1 > 0
u = 0;
else
u = 1;
end

% 判断信号是否满足IMF条件
% 条件:极大值点数和极小值点数之和与过零点数相等或相差1?
function u = isimf(x)

N = length(x);
u1 = sum(x(1:N-1).*x(2:N) < 0);
u2 = length(findpeaks(x))+length(findpeaks(-x));
if abs(u1-u2) > 1
u = 0;
else
u = 1;
end

% 使用三次样条函数,得到包络线
function s = getspline(x)

N = length(x);
p = findpeaks(x);
s = spline([0 p N+1],[0 x§ 0],1:N);

% 寻找极大值点
function n = findpeaks(x)
% Find peaks.
% n = findpeaks(x)

n = find(diff(diff(x) > 0) < 0);
u = find(x(n+1) > x(n));
n(u) = n(u)+1;

e后,将生成1级标题。
输入2次#,并按下space后,将生成2级标题。
以此类推,我们支持6级标题。有助于使用TOC语法后生成一个完美的目录。

如何改变文本的样式

强调文本 强调文本

加粗文本 加粗文本

标记文本

删除文本

引用文本

H2O is是液体。

210 运算结果是 1024.

插入链接与图片

链接: link.

图片:

带尺寸的图片:

居中的图片:

居中并且带尺寸的图片:

当然,我们为了让用户更加便捷,我们增加了图片拖拽功能。

如何插入一段漂亮的代码片

去博客设置页面,选择一款你喜欢的代码片高亮样式,下面展示同样高亮的 代码片.

// An highlighted block
var foo = 'bar';

生成一个适合你的列表

  • 项目

    • 项目

      • 项目
  1. 项目1
  2. 项目2
  3. 项目3
  • 计划任务
  • 完成任务

创建一个表格

一个简单的表格是这么创建的:

项目 Value
电脑 $1600
手机 $12
导管 $1

设定内容居中、居左、居右

使用:---------:居中
使用:----------居左
使用----------:居右

第一列 第二列 第三列
第一列文本居中 第二列文本居右 第三列文本居左

SmartyPants

SmartyPants将ASCII标点字符转换为“智能”印刷标点HTML实体。例如:

TYPE ASCII HTML
Single backticks 'Isn't this fun?' ‘Isn’t this fun?’
Quotes "Isn't this fun?" “Isn’t this fun?”
Dashes -- is en-dash, --- is em-dash – is en-dash, — is em-dash

创建一个自定义列表

Markdown
Text-to-HTML conversion tool
Authors
John
Luke

如何创建一个注脚

一个具有注脚的文本。1

注释也是必不可少的

Markdown将文本转换为 HTML

KaTeX数学公式

您可以使用渲染LaTeX数学表达式 KaTeX:

Gamma公式展示 Γ(n)=(n−1)!∀n∈N\Gamma(n) = (n-1)!\quad\forall n\in\mathbb NΓ(n)=(n−1)!∀n∈N 是通过欧拉积分

Γ(z)=∫0∞tz−1e−tdt.\Gamma(z) = \int_0^\infty t^{z-1}e^{-t}dt\,. Γ(z)=∫0∞​tz−1e−tdt.

你可以找到更多关于的信息 LaTeX 数学表达式here.

新的甘特图功能,丰富你的文章

Mon 06Mon 13Mon 20已完成 进行中 计划一 计划二 现有任务Adding GANTT diagram functionality to mermaid
  • 关于 甘特图 语法,参考 这儿,

UML 图表

可以使用UML图表进行渲染。 Mermaid. 例如下面产生的一个序列图:

张三李四王五你好!李四, 最近怎么样?你最近怎么样,王五?我很好,谢谢!我很好,谢谢!李四想了很长时间,文字太长了不适合放在一行.打量着王五...很好... 王五, 你怎么样?张三李四王五

这将产生一个流程图。:

链接
长方形
圆角长方形
菱形
  • 关于 Mermaid 语法,参考 这儿,

FLowchart流程图

我们依旧会支持flowchart的流程图:

Created with Raphaël 2.2.0开始我的操作确认?结束yesno
  • 关于 Flowchart流程图 语法,参考 这儿.

导出与导入

导出

如果你想尝试使用此编辑器, 你可以在此篇文章任意编辑。当你完成了一篇文章的写作, 在上方工具栏找到 文章导出 ,生成一个.md文件或者.html文件进行本地保存。

导入

如果你想加载一篇你写过的.md文件,在上方工具栏可以选择导入功能进行对应扩展名的文件导入,
继续你的创作。


  1. 注脚的解释 ↩︎

matlab相关,来自一个初学者的收藏相关推荐

  1. 从零开始学视觉里程计——一个初学者教程

    从零开始学视觉里程计--一个初学者教程 目录 从零开始学视觉里程计--一个初学者教程 什么是里程计 什么是视觉里程计 为什么使用立体相机,或者为什么使用单目相机? 理论足够了,现在讨论算法 问题描述 ...

  2. java使用d3_[Java教程]一个初学者的指南,使用D3做数据绑定

    [Java教程]一个初学者的指南,使用D3做数据绑定 0 2016-07-03 13:00:09 一个初学者的指南,使用D3做数据绑定 D3.js 是个强大的数据可视化库,可以做出惊艳的图表.比如:气 ...

  3. 网易明日之后那个服务器人最多,明日之后:网易“公认”全服前4强营地出炉,竟全部来自一个区...

    原标题:明日之后:网易"公认"全服前4强营地出炉,竟全部来自一个区 欢迎诸位小伙伴们来到本期天哥开讲的<明日之后>"生存那点事儿"~在上一期里呢,我 ...

  4. 短视频剪辑自学需要掌握的小技巧,初学者可收藏

    短视频剪辑自学需要掌握的小技巧,初学者可收藏 如今自学短视频剪辑的小伙伴可以说是越来越多,毕竟短视频剪辑的入门还是很简单的.只不过若是想要在短视频剪辑领域中做出成绩,那么还是需要不断的练习.那么今天我 ...

  5. 来自一个入行三年半的大数据练习生自述

    来自一个入行三年半的大数据练习生自述 精通唱跳Rap&篮球的一只卑微小码农*_* 18届毕业的本科生,一所普通二本,计算机专业,初次接触到大数据这个词汇,还是在大二时候,在下就是逃课不听课大学 ...

  6. 报有一个初学者的心态_初学者的心态

    报有一个初学者的心态 "Read the books, practice everyday. Focus - Be a monk." "读书,每天练习. 专注--成为一个 ...

  7. KDD 2022 | 深度图神经网络中的特征过相关:一个新的视角

    目录 前言 1 引言 2 背景和相关工作 2.1 GNN 2.2 相关工作 3 Preliminary Study 3.1 过相关和过平滑 3.2 过相关分析 3.2.1 传播导致更高的相关性 3.2 ...

  8. 用matlab自己搭建bp神经网络,怎样在matlab里建立一个BP神经网络模型?

    该楼层疑似违规已被系统折叠 隐藏此楼查看此楼 用以下的数据怎样在matlab里建立一个BP神经网络模型?求高手帮忙!!最好是有详细步骤以及代码 年份 WTI(美元/桶) 2007-1 54.26 20 ...

  9. semilogx 多条曲线_怎么让两个指数在一个坐标,matlab里怎样一个坐标上显示多个曲线,而且横轴要用指数形式的?谢谢...

    Q1:matlab里怎样一个坐标上显示多个曲线,而且横轴要用指数形式的?谢谢 多个纵轴数组分别是y1,y2,y3,横轴数组为x 命令为: semilogx(x,y1,x,y2,x,y3) 完了 Q2: ...

最新文章

  1. Jmeter性能测试 入门
  2. c++11 字符串与int类型的转换
  3. 树莓派 使用读卡器修改WIFI连接配置
  4. 《网络攻防实践》第二周学习总结
  5. 统计学习方法第五章作业:ID3/C4.5算法分类决策树、平方误差二叉回归树代码实现
  6. 分节符缩写p_p值的缩写是什么?
  7. 前端学习(642):字面量
  8. docker依赖的Linux内核特性及各命令参数说明
  9. 关闭所有的screen
  10. (Abstract Factory)抽象工厂模式的Java实现
  11. 12月21诛仙服务器维护,1月21日全服停机更新维护公告
  12. UNIX网络编程第三版
  13. PCM音频压缩A-Law算法,uLaw
  14. android ionic框架,移动App开发框架—Ionic
  15. 贝叶斯(三)先验分布的确定
  16. 婚姻法新解释引女方净身出户担忧 或导致房产加名热
  17. 阿里云设置登录掩码错误无法登录
  18. 数字化进阶在即,智慧医院建设迎来黄金期-2020爱分析·中国智慧医院行业趋势报告
  19. 【java基础】int和tinyint的区别
  20. 2java第一章复习总结

热门文章

  1. css 文字不规则排版,CSS3文字排版
  2. MAC地址和IP地址说明
  3. [Spark] GraphX入门
  4. SimpleDateFormat大写Y和小写y的区别
  5. 主流数据库书籍电子版下载汇总贴(84本)
  6. 智慧水务平台“爱水APP”助力搭建智慧城市
  7. 江苏联亚国际展览中心跨境展批发产品B2B门户线上展会平台matchup expo SEO工作日志
  8. Pocket英语语法---六、感官动词接不同的动词表示什么意思
  9. 团队创意游戏4:社交网
  10. c语言怎样控制键盘的方向键,c++怎么获取键盘的方向键