频率v=K/N (K=0,1,…N/2)
clear,clc
figure(1);
%画布布局
x = linspace(0,20,1000);
y = [-1:1];
[X,Y] = meshgrid(x,y);
%循环计算出8个基函数
for k = 0 : 7
y1 = cos(2*pi*k*x/16);
y2 = sin(2*pi*k*x/16);
subplot(2,4,k+1) % 绘制子图k
plot(x,y1,x,y2)
title(sprintf("k = %d", k))
legend(sprintf('cos(2n%dπ/N)', k), sprintf('sin(2n%dπ/N)', k));
end
imshow()