作者zj44 (YY)
看板MATLAB
标题[绘图] 数位讯号绘图
时间Fri Dec 9 21:55:53 2011
这是使用内建spline
但是就是画不出两个图
不知道出了甚麽bug....
clear; close all;
t = 0:0.001:1; xa = cos(20*pi*t);
Ts = 0.05; Fs = 1/Ts;
xa1=spline(Ts*n1,x1,t);
subplot(3,1,1);plot(t,xa1); axis([0,1,-1.1,1.1]);
ylabel('xa(t)'); title('Reconstruction of xa(t) when Ts=0.01');
Ts = 0.05; Fs = 1/Ts;
xa2 = spline(Ts*n2,x2,t);
subplot(3,1,2);plot(t,xa2); axis([0,1,-1.1,1.1]);
ylabel('xa(t)'); title('Reconstruction of xa(t) when Ts=0.05');
Ts = 0.1; Fs = 1/Ts;
xa3 = spline(Ts*n3,x3,t);
subplot(3,1,3);plot(t,xa3); axis([0,1,-1.1,1.1]);
ylabel('xa(t)'); title('Reconstruction of xa(t) when Ts=0.1');
xlabel('t,sec');
第二个使用
sinc函数
clear; close all;
t = 0:0.001:1; xa = cos(20*pi*t);
Ts = 0.01; Fs = 1/Ts;
xa1 = x1*sinc(Fs*(ones(length(n1),1)*t-(n1*Ts)'*ones(1,length(t))));
subplot(3,1,1);plot(t,xa1); axis([0,1,-1.1,1.1]);
ylabel('xa(t)'); title('Reconstruction of xa(t) when Ts=0.01');
Ts = 0.05; Fs = 1/Ts;
xa2 = x2*sinc(Fs*(ones(length(n2),1)*t-(n2*Ts)'*ones(1,length(t))));
subplot(3,1,2);plot(t,xa2); axis([0,1,-1.1,1.1]);
ylabel('xa(t)'); title('Reconstruction of xa(t) when Ts=0.05');
Ts = 0.1; Fs = 1/Ts;
xa3 = x3*sinc(Fs*(ones(length(n3),1)*t-(n3*Ts)'*ones(1,length(t))));
subplot(3,1,3);plot(t,xa3); axis([0,1,-1.1,1.1]);
ylabel('xa(t)'); title('Reconstruction of xa(t) when Ts=0.1');
xlabel('t,sec');
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 140.137.2.6
1F:推 diva:是不是你第二张图被close all关掉了 12/09 21:57
改掉还是一样....
Error in ==> Untitled2222 at 4
xa1 = x1*sinc(Fs*(ones(length(n1),1)*t-(n1*Ts)'*ones(1,length(t))));
※ 编辑: zj44 来自: 140.137.2.6 (12/09 22:08)
2F:推 flylee:x1 宣告在哪 ? 12/10 02:48
3F:→ Rasin:n1, x1是什麽 12/10 09:58