⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 keypoint.m

📁 自己编写的实现时间序列中的关建点搜索
💻 M
字号:
function [keyda1]=keypoint(data,K,t)%function [ keyda1,keyda2,keydata ] = keypoint( data,m,n,t)%UNTITLED1 Summary of this function goes here%  Detailed explanation goes here%keyda1 存储夹角方法取得的关键点%keyda2 存储幅值方法取得的关键点%data is the time series data which you want to search key point%m is the threshold value of angle%n is the threshold value of amplitude%t is the time per sample-ratekeyda1(1)=data(1);[d,n]=size(data);j=2;for i=2:n-1   %求斜率   a=[data(i)-data(i-1)]/t;   b=[data(i)-data(i+1)]/t;   if a*b==1       e(i)=pi/2;    else    c=(b-a)/(1-a*b);   e(i)=atan(c);    %计算出的夹角  endend[f,ind]=sort(e)  %夹角排序  s=1;  for j=2:K+1      keyda1(j)=data(ind(s));      s=s+1;  end

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -