当 Ui(t) > Uo(t-) 时 Uo(t) = Ui(t)
当 Ui(t) < Uo(t-) 时
RC dUo/dt = Uo
化成差分方程为:
把这个过程用程序来实现就有了下面的代码。
clear all;
x = 0:0.000001:0.005;
y = sin(200000.*pi.*x) .* (sin(2000.*pi.*x)*0.2 + 0.5);
mold = 0.0;
out = x;
rc = 400;
for i=1:5000
if y(i) > mold
mold = y(i);
else
mold = (mold * rc)/(rc + 1);
end
out(i) = mold;
end
subplot(211);
plot(y);
subplot(212);
plot(out);
% 半波
% void env_half(double in[], double out[], int N)
% {
% for(int i = 0; i < N; i++)
% {
% if( in[i] > m_old)
% {
% m_old = in[i];
% out[i] = m_old;
% }
% else
% {
% m_old *= m_rct / ( m_rct + 1 );
% out[i] = m_old;
% }
% }
% }
% 全波
% void env_full(double in[], double out[], int N)
% {
% double abs_in;
% for(int i = 0; i < N; i++)
% {
% abs_in = fabs(in[i]);
% if( abs_in > m_old)
% {
% m_old = abs_in;
% out[i] = m_old;
% }
% else
% {
% m_old *= m_rct / ( m_rct + 1 );
% out[i] = m_old;
% }
% }
% }
这篇博客介绍了简单的包络检波原理,通过比较输入信号Ui(t)和输出信号Uo(t-)的大小来更新输出。当输入大于输出时,输出等于输入;否则,利用RC电路的特性更新输出。博主通过解析差分方程,展示了如何将这一过程转化为编程代码。
412

被折叠的 条评论
为什么被折叠?



