matlab中使用正弦波合成方波(带动画)
x=0:0.1:6*pi; for step=1:2:100 s=0; for i=1:2:step s = s+1/i*sin(i*x); end plot(s);set(figure(1),'visible','off'); filename=[num2str(step, '%04d'),'.png']; print(1, '-dpng',filename); end
x=0:0.1:6*pi; for step=1:2:100 s=0; for i=1:2:step s = s+1/i*sin(i*x); end plot(s);set(figure(1),'visible','off'); filename=[num2str(step, '%04d'),'.png']; print(1, '-dpng',filename); end