2020-10-30

作者:神秘网友 发布时间:2020-10-31 15:00:26

2020-10-30

2020-10-30

基于MATLAB的离散时间全通系统和系统辨识

2020-10-30

主程序

clear
clc
%主程序(main_DTFT)
nandy1 = [0.6 0.6 0.6]; %定义frame控件的背景色
nandy = [1 1 1];        %定义整个图形的背景色
nandy2 = [0.7 0.7 0.7]; %定义缺省控件的背景色
mm = 1; hyh = 1; N = 30;
w = 0.3; w1 = 0.7;
N1 = 80;  W1 =0.2;  W2 = 0.65;
b1 = 1; A =1;
%设定图形界面
h_mm = figure('name','DTFT的滤波器设计',...
    'units','normalized','position',[0.15 0.1 0.75 0.8],...
    'menubar','none','numbertitle','off','Color',nandy);
%设定图形句柄的各项属性
set(h_mm,'defaultuicontrolfontsize',11);
set(h_mm,'defaultuicontrolbackgroundcolor',nandy2);
set(h_mm,'defaultuicontrolunits','normalized');
set(h_mm,'defaultuicontrolfontunits','pixels');
set(h_mm,'defaultuicontrolfontname','幼圆');
%设定轴对象
h_axes1 = axes('position',[0.06 0.71 0.4 0.23],...
    'visible','on');
grid;
set(h_axes1,'color',nandy2);
h_axes2 = axes('position',[0.56 0.71 0.4 0.23],...
    'visible','on');
grid;
set(h_axes2,'color',nandy2);
set(h_axes1,'color',nandy2);
h_axes3 = axes('position',[0.06 0.38 0.4 0.23],...
    'visible','on');
grid;
set(h_axes3,'color',nandy2);
title('原信号波形');
set(h_axes1,'color',nandy2);
h_axes4 = axes('position',[0.06 0.05 0.4 0.23],...
    'visible','on');
grid;
set(h_axes4,'color',nandy2);
title('滤波后波形');
%设定菜单
h_menu1 = uimenu(h_mm,'label','负责人','callback','zdjs');
h_menu2 = uimenu(h_mm,'label','设计人员','callback','sjry');
zmenu = uimenu(h_mm,'label','动态标定');
h_menu3 = uimenu(zmenu,'label','离散时间全通系统','callback','clear,close,qtxt');
h_menu4 = uimenu(zmenu,'label','系统辨识','separator','on',...
    'callback','close,xtbs');
h_menu6 = uimenu(h_mm,'label','关闭','callback','clear,close,clc');
%设定控件区域框
h_framel = uicontrol(h_mm,'style','frame','position',...
    [0.56 0.03 0.4 0.305],'backgroundcolor',nandy1);
h_frame2 = uicontrol(h_mm,'style','frame','position',...
    [0.56 0.32 0.4 0.305],'backgroundcolor',nandy1);
%设定滑动键
h_sliderl = uicontrol(h_mm,'style','slider','position',...
[0.57 0.34 0.18 0.04],'max',0.55,'min',0.05,'value',W1,...
'callback',['W1 = gett(h_silder1,2);',...
'HYHN(h_axes1,h_axes2,N,W1,W2,mm,b1)']);

h_slider2 = uicontrol(h_mm,'style','slider','position',...
[0.77 0.34 0.18 0.04],'max',0.95,'min',0.55,'value',W2,...
'callback',['W2 = gett(h_silder2,2);',...
'HYHN(h_axes1,h_axes2,N,W1,W2,mm,b1)']);

h_slider3 = uicontrol(h_mm,'style','slider','position',...
[0.57 0.44 0.18 0.04],'max',150,'min',10,'sliderstep',[0 0.1],'value',...
N,'callback',['N = gett(h_silder3,2);',...
'HYHN(h_axes1,h_axes2,N,W1,W2,mm,b1)']);

h_slider4 = uicontrol(h_mm,'style','slider','position',...
[0.57 0.06 0.18 0.04],'max',0.5,'min',0.1,'value',...
w,'callback',['w = gett(h_silder4,2);',...
'[new,y,Fs]=syxhhd(h_axes3,h_axes4,w,w1,N1,hyd,b1);']);

h_slider5 = uicontrol(h_mm,'style','slider','position',...
[0.77 0.18 0.18 0.04],'max',150,'min',10,'sliderstep',[0 0.1],'value',...
N1,'callback',['N1 = gett(h_silder5,2);',...
'[new,y,Fs]=syxhhd(h_axes3,h_axes4,w,w1,N1,hyd,b1);']);

h_slider6 = uicontrol(h_mm,'style','slider','position',...
[0.77 0.06 0.18 0.04],'max',0.9,'min',0.6,'sliderstep',[0 0.1],'value',...
w1,'callback',['w1 = gett(h_silder6,2);',...
'[new,y,Fs]=syxhhd(h_axes3,h_axes4,w,w1,N1,hyd,b1);']);
%设定各种静态文本框
h_text1 = uicontrol(h_mm,'style','text','position',[0.57 0.58 0.18 0.04],...
    'string','滤波器的类型','backgroundcolor',nandy1,'fore','w');

h_text2 = uicontrol(h_mm,'style','text','position',[0.57 0.48 0.18 0.04],...
    'string','滤波器的阶数','backgroundcolor',nandy1,'fore','w');

h_text3 = uicontrol(h_mm,'style','text','position',[0.57 0.39 0.18 0.04],...
    'string','上限频率W1','backgroundcolor',nandy1,'fore','w');
h_text4 = uicontrol(h_mm,'style','text','position',[0.77 0.39 0.18 0.04],...
    'string','下限频率W2','backgroundcolor',nandy1,'fore','w');

h_text5 = uicontrol(h_mm,'style','text','position',[0.76 0.58 0.18 0.04],...
    'string','信号','backgroundcolor',nandy1,'fore','w');

h_text6 = uicontrol(h_mm,'style','text','position',[0.57 0.11 0.18 0.04],...
    'string','第一截止频率','backgroundcolor',nandy1,'fore','w');
h_text7 = uicontrol(h_mm,'style','text','position',[0.77 0.11 0.18 0.04],...
    'string','第二截止频率','backgroundcolor',nandy1,'fore','w');

h_text8 = uicontrol(h_mm,'style','text','position',[0.77 0.22 0.18 0.04],...
    'string','阶数控制','backgroundcolor',nandy1,'fore','w');

%设定弹出框
h_popup1 = uicontrol(h_mm,'style','popup','string',...
    '阶跃|脉冲|谐振','position',...
    [0.77 0.55 0.18 0.03],'back','w','call',...
   ['num=gett(h_popup1,2);',...
   'if num == 1,hyh = 1;',...
   '[new,y,Fs]=syxhhd(h_axes3,h_axes4,w,w1,N1,hyh,b1);end,',...
   'if num == 2,hyh = 2;',...
   '[new,y,Fs]=syxhhd(h_axes3,h_axes4,w,w1,N1,hyh,b1);end,',...
   'if num == 3,hyh = 3;',...
   '[new,y,Fs]=syxhhd(h_axes3,h_axes4,w,w1,N1,hyh,b1);end,']);

%creat push
h_push = uicontrol(h_mm,'style','push','position',[0.77 0.45 0.18 0.05],...
    'string','原信号输出','fore','w','call','sound(y,Fs)');
h_push1 = uicontrol(h_mm,'style','push','position',[0.57 0.18 0.19 0.05],...
    'string','滤波后信号输出','fore',[0 0 0],'fontsize',12,'call','sound(new,Fs)');
h_popup = uicontrol(h_mm,'style','popup','string',...
    '带通滤波器|带阻滤波器|多通带滤波器|多阻带滤波器|低通滤波器|高通滤波器',...
    'position',[0.57 0.55 0.18 0.33],'back','w',...
    'Callback',['number=gett(h_popup,2);',...
    'if number>4,bnkj(h_slider1,h_slider2,h_slider3,1);end,',...
    'if number<5,bnkj(h_slider1,h_slider2,h_slider3,2);end,',...
    'if number==1,mm=1;'...
    'HYHN(h_axes1,h_axes2,N,W1,W2,mm,b1);end,',...
     'if number==2,mm=2;'...
    'HYHN(h_axes1,h_axes2,N,W1,W2,mm,b1);end,',...
     'if number==3,mm=3;'...
    'HYHN(h_axes1,h_axes2,N,W1,W2,mm,b1);end,',...
     'if number==4,mm=4;'...
    'HYHN(h_axes1,h_axes2,N,W1,W2,mm,b1);end,',...
     'if number==5,mm=5;'...
    'HYHN(h_axes1,h_axes2,N,W1,W2,mm,b1);end,',...
     'if number==6,mm=6;'...
    'HYHN(h_axes1,h_axes2,N,W1,W2,mm,b1);end,']);
%
% HYHN(h_axes1,h_axes2,N,W1,W2,mm,b1);
%
[new,y,Fs] = syxhhd(h_axes3,h_axes4,w,w1,N1,mm,b1)

子程序

function [new,y,Fs]=syxhhd(h_axes3,h_axes4,w,w1,N1,mm,b1)
if mm==1
   load chirp.mat;
elseif mm ==2
   load laughter.mat;
elseif mm == 3
   load gong.mat;
elseif mm == 4
   load train.mat
elseif mm == 5
   [y,Fs]=waveread('sound1');
elseif mm == 5
   [y,Fs]=waveread('sound1'); 
elseif mm == 6
   [y,Fs]=waveread('fly'); 
elseif mm == 7
   [y,Fs]=waveread('ringin'); 
elseif mm == 8
   [y,Fs]=waveread('ghost'); 
elseif mm == 9
   [y,Fs]=waveread('gun'); 
elseif mm == 10
   [y,Fs]=waveread('sound42'); 
end
W = [w,0.05,w1,0.95];
b = fir1(N1,W,'low');%第一个频带为阻带
new = fftfilt(b,y);
if b1 == 1
   axes(h_axes3)
   cla;
   t =length(y);
   T = 1:t;
   plot(T,y,'b');
   set(h_axes3,'color',[0.7 0.7 0.7],'ylim',[-1 1])
   title('信号波形')
   grid on
   axes(h_axes)
   cla;
   plot(T,new,'g');
  set(h_axes4,'color',[0.7 0.7 0.7],'ylim',[-1 1])
  title('滤波后波形');
   grid on
end

2020-10-30相关教程

  1. 2020-10-30

    2020-10-30 #includestdio.h#includestdlib.h#includemalloc.htypedef int DataType; typedef struct Node { DataType data; struct Node *next; } Node;Node *CreatList(DataType a[],int n)//头插法建立单链表 { Node *s=NULL; Node *first =(Node * )mallo

  2. 2020-10-30

    2020-10-30 文章目录 pscad自动化库学习篇workspace.create_project() 参数讲解 博主遇到的问题 参数讲解 workspace.create_project()需要传入三个参数,**(prj_type,name,path)**分别对应新建的项目类型(1是case,2是library),name就是新建项目的名字,

  3. 如何自己申请免费的通配符证书(基于 Let‘s Encrypt 的免费证书

    如何自己申请免费的通配符证书(基于 Let‘s Encrypt 的免费证书) 最近项目上线,需要用到https,在网上找到了可以白嫖的证书,记录一下使用过程 Let’s Encrypt一个非盈利性的证书颁发机构,并且已经被大多数浏览器所信任,而我们可以使用Certbot(一个免费

  4. 基于ROS搭建简易软件框架实现ROV水下目标跟踪(十四完结)--目标

    基于ROS搭建简易软件框架实现ROV水下目标跟踪(十四完结)--目标跟踪模块 模块十分简单,可以介绍的内容很少。包括两个部分:计算目标物中心距图片中心的偏差,对应cabin_vision/object_deviation;PID跟踪控制,对应cabin_behaviors/pid_tracking。 一、偏差

  5. 【Spring】基于XML的IOC案例

    【Spring】基于XML的IOC案例 代码结构: bean.xml ?xml version=1.0 encoding=UTF-8?beans xmlns=http://www.springframework.org/schema/beans xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance xsi:schemaLocation=http://www.springframework.org/sch

  6. 基于cloudera manager的大数据集群平台搭建之集群服务安装

    基于cloudera manager的大数据集群平台搭建之集群服务安装 继续上篇,这篇介绍集群服务安装 监控服务安装 出现如下界面的原因是我们没有安装监控服务,因此应该首先安装监控服务,便于后面安装其他服务的过程出现问题的排查。 点击如下直接进行添加监控服务的

  7. STM32L475基于RT-Thread PWM模块的使用注意事项

    STM32L475基于RT-Thread PWM模块的使用注意事项 STM32L475基于RT-Thread PWM模块的使用注意事项 关于RT-Thread PWM模块配置的步骤可参考官方提供的步骤来进行配置,但是官方讲解的不全面,按照官方的配置来进行配置最后下载到板子里面验证时候没有波形输出,

  8. 基于应用日志的扫描器检测实践

    基于应用日志的扫描器检测实践 基于应用日志的扫描器检测实践 在网络上搜索web扫描器时,各类扫描器工具、扫描攻略玲琅满目,但对扫描器检测方法的内容却少之又少。因此,本文对各类web扫描特特征进行了梳理和总结,并结合苏宁应用防火墙(SNWAF)日志数据,