📄 dfs_examples.m
字号:
% dfs_examples.m
% 根据编写的dfs进行插值计算
T=0.1;N=32;
ti=[0:T/5:(N-1)*T];
w1=pi;w2=1.5*pi;
n=[0:N-1];
t=n*T;
x=sin(w1*t)+1.5*sin(w2*t)+rand(1,N)-0.8;
% 绘制原始函数的图形
subplot(411);
plot(t,x,'k.');
title('original and interp signal');
grid on; axis tight; hold on;
% 使用前面定义的M函数进行插值
[xi,yi]=interp_dfs(T,x,1,ti);
plot(ti,xi,'r');
k=[0:N-1];
subplot(412);
stem(k,abs(yi),'k.');
axis tight;
title('original spectrum');
% 使用新参数进行绘制
[xi,yi]=interp_dfs(T,x,1/2,ti);
subplot(413);
stem(k,abs(yi),'r.');
axis tight;
title('filtered spectrum');
% 绘制插值图形
subplot(414)
plot(t,x,'k.',ti,xi,'r');
title('filtered/smoothed signal')
grid on; axis tight;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -