DSP

信号与系统笔记

DSP相关讨论

常用指令

  1. 导出时设置颜色为透明色:
1
set(gca,'color','none');
  1. 设置matlab图像默认为白色:
1
set(0,'defaultfigurecolor','w')
  1. 设置动画:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
% 画一下sinc函数随着参数变化时的图像变化
fig = figure;
% x = linspace(0, 2*pi, 100);
t=-3:0.001:3;
im = cell(1, 20);
for i = 1:15

clf(fig);
dis=0.8;
func1= sinc_me(t,10*i);
func2= sinc_me(t-0.02*pi,10*i);
subplot(2,1,1);
plot(t,func1);
hold on;
plot(t,func2);
legend('N=10','N=10');
subplot(2,1,2);
plot(t,func1+func2);
set(get(gca, 'Title'), 'String', num2str(i));
hold off;
% plot(x, y, 'Color', all_colors(1, :), 'LineWidth', 2);
% xlim([0, 2*pi]);
pause();
% 注释下面两句话可以看到动态输出
% frame = getframe(fig);
% im{i} = frame2im(frame);
end
% 下面是保存成 gif
% filename = './Matlab_2_7_6_Curve_Animation1.gif';
% for idx = 1:20
% % 制作gif文件,图像必须是index索引图像
% [A, map] = rgb2ind(im{idx}, 256);
% if idx == 1
% imwrite(A, map, filename, 'gif', 'LoopCount', Inf, 'DelayTime', 0.3);
% else
% imwrite(A, map, filename, 'gif', 'WriteMode', 'append', 'DelayTime', 0.3);
% end
% end
  1. 设置latex显示
1
set(get(gca, 'Title'), 'String','$x_1(k)$', 'interpreter','latex','Fontsize',18);
  1. 设置画布大小(其中0.7和0.6是画布的长和宽)
1
figure('units','normalized','position',[0.1,0.1,0.7,0.6])