|
看帖找空试, 回头才发现LZ已经又编辑了!
1.LZ给的部分码无法直接试, 有点不方便, 只得随意產生信号再试- clc; clear
- y=5*rand(1,1605); y0=y(596:1605); time=[0:141605]/1000; t=time(140596:141605);
- d = diff(y0); n = length(d); d1 = d(1:n-1); d2 = d(2:n);
- indmin = find(d1.*d2<0 & d1<0&d2>1.5)+1;
- indmax = find(d1.*d2<0 & d1>1.5&d1<1.5)+1;
- envmin = pchip(t(indmin),y0(indmin),t);
- envmax = pchip(t(indmax),y0(indmax),t);
- plot(t,envmax,'m',t,envmin,'r')
复制代码 2."There should be at least two data points."是针对pchip输入空矩阵, 往前追是indmax空矩阵造成
3.indmax = find(d1.*d2<0 & d1>1.5&d1<1.5)+1, 裡头d1>1.5&d1<1.5怪怪的
4.参考下
一种有效的包络线算法 http://forum.vibunion.com/thread-32967-1-1.html
求画出振荡的包络线图 http://forum.vibunion.com/thread-28736-1-1.html
from http://home.vibunion.com/blog-63979-18250.html |
|