作者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