• 大小: 3KB
    文件类型: .m
    金币: 1
    下载: 0 次
    发布日期: 2021-01-11
  • 语言: Matlab
  • 标签: MATLAB  动画  滞环  

资源简介

滞环用MATLAB语言编写,而且加入了动画演示效果。

资源截图

代码片段和文件信息

clc
clear
close all
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

B=1; %环的高度
m=1.5;%m是向量,向量的长度代表环的个数
A=0.25;% 环的宽度,[-(mA+AmA)][mAmA+A] 表示环的边界
n=1:512;
x=cos(2*pi/50*n);  %抽样信号
N=length(x);
% x=abs(x);
% x=x+0.1*randn(1N);

Xmax=max(abs(x));
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% % 绘制环
DT=[m*A0
   m*AB
   m*A+AB
    m*A+A0
    m*A0
    -m*A0
    -m*A-B
    -m*A-A-B
   -m*A-A0
 -m*A 0];
DTsize=size(DT);
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
state=[1x(1)B3];%初始状态

for i=2:N
    
    state(i1)=i;
    state(i2)=x(i);
    if x(i)<=-m*A-A
        state(i4)=-3;
    elseif x(i)>-m*A-A & x(i)<-m*A
        state(i4)=-2;
    elseif x(i)>-m*A & x(i)<0
        state(i4)=-1;
    elseif 

评论

共有 条评论