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

📄 ramp_gen.m

📁 异步电机矢量控制各模块仿真m函数
💻 M
字号:
function [out] = ramp_gen(gain,offset,freq,time)
% This function computes the ramp signal
% Inputs:  
%         gain = Gain to output
%         offset = Offset to output
%         freq = Frequency (Hz)
%         time = Time (sec)
% Output:
%         out = Ramp signal varying between 0 and 1 for gain=1 and offset=0

T_ramp = 1/abs(freq);          % Period of ramp signal (sec)
time_rmp = rem(time,T_ramp);   % time for computing the output (sec)

if freq > 0     % ramp from 0 to 1 if freq > 0 (for gain=1, offset=0)
   out = gain*(1/T_ramp)*time_rmp + offset;
else            % ramp from 1 to 0 if freq < 0 (for gain=1, offset=0)
   out = gain*(-(1/T_ramp)*time_rmp+1) + offset;
end   


⌨️ 快捷键说明

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