[繪圖] 數位訊號繪圖

看板MATLAB作者 (YY)時間14年前 (2011/12/09 21:55), 編輯推噓2(201)
留言3則, 3人參與, 最新討論串1/1
這是使用內建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

12/09 21:57, , 1F
是不是你第二張圖被close all關掉了
12/09 21:57, 1F
改掉還是一樣.... 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)

12/10 02:48, , 2F
x1 宣告在哪 ?
12/10 02:48, 2F

12/10 09:58, , 3F
n1, x1是什麼
12/10 09:58, 3F
文章代碼(AID): #1EuXDiwL (MATLAB)