fun.m

来自「里面囊括了基于matlab滤波器设计的各种.m文件」· M 代码 · 共 24 行

M
24
字号
 
% The objective function of the optimization
% The greater the Alfa, the better the stopband
% Successful but the result is not very good

function [f,g] = fun(x)
f1 = 0;
f2 = 0;
f = 0;
Alfa=0.7;
N = size(x,2);

stopedge = 0.4*pi;
omega = stopedge;
step = (pi-stopedge)/1024;
for I = 1:1024
  omega = omega + step;
  for J = 1:N
    c(J) = cos(((J-1)+0.5)*omega);
  end
  part = x*c'*c*x';
  f1 = f1 + part;
end

⌨️ 快捷键说明

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