?? ripple.m
字號:
function r = ripple(waveform)
% Function to calculate the ripple on an input waveform.
% Calculate the average value of the waveform
nvals = size(waveform,2);
temp = 0;
for ii = 1:nvals
temp = temp + waveform(ii);
end
average = temp/nvals;
% Calculate rms value of waveform
temp = 0;
for ii = 1:nvals
temp = temp + waveform(ii)^2;
end
rms = sqrt(temp/nvals);
% Calculate ripple factor
r = sqrt((rms / average)^2 - 1) * 100;
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -