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

📄 f_funx.m

📁 DSP程序 Matlab是一套用于科学工程计算的可视化高性能语言与软件环境。它集数值分析、矩阵运算、信号处理和图形显示于一体
💻 M
字号:
function x = f_funx (t,xm,userinput,X)

%F_FUNX: Compute a selected input signal
%
% Usage: x = f_funx(t,xm,userinput,X);
%
% Inputs: 
%         t         = evaluation time 
%         xm        = input mode
%         userinput = a string specifying the name of a user
%                     defined function: x = userinput(t)
%         X         = p by 2 array containing breakpoints for
%                     piecewise-constant input (optional)
% Outputs: 
%          x = value of input signal at time t
%
% Note: Used by f_plotsamp, and f_plotrec

x = 0;
switch xm
   
case 0,                               % piecewise-linear (used by 
   p = size(X,1);                     % Butterworth)
   dt = (X(p,1)-X(1,1))/(p-1);
   k = 1 + floor((t - X(1,1))/dt);
   k = max(1,min(p-1,k));
   alpha = (t - X(k,1))/dt;
   x = (1-alpha).*X(k,2) + alpha.*X(k+1,2);
case 1,
   x = ones(size(t));
case 2,
   x = exp(-t);
case 3,
   x = cos(2*pi*t);
case 4,
   x = sign(sin(2*pi*t));
case 5,
   x = feval(userinput,t);
end

⌨️ 快捷键说明

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