?? pulse.m
字號:
function volts = pulse(wt)
% Function to simulate the output of a half-wave rectifier.
% wt = Phase in radians (=omega x time)
% Convert input to the range 0 <= wt < 2*pi
while wt >= 2*pi
wt = wt - 2*pi;
end
while wt < 0
wt = wt + 2*pi;
end
% Simulate the output of the line
if wt >= pi/4 & wt <= 3*pi/4
volts = sin(2*(wt-pi/4));
elseif wt >= 5*pi/4 & wt <= 7*pi/4
volts = -sin(2*(wt-5*pi/4));
else
volts = 0;
end
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -