[問題] 將音檔用濾波器繪圖

看板MATLAB作者 (CatEar)時間10年前 (2014/04/07 18:30), 10年前編輯推噓1(100)
留言1則, 1人參與, 最新討論串1/1
之前只有貼上部分的程式碼 沒注意到部分的宣告在其他地方 對不起OTZ 很抱歉造成大家的困擾 感謝labbat大大!!! 以下是全部的程式碼 clear all; close all; y= wavread('H:\MyVoice1.wav'); y1=25*y(:,1); t=10/423936*[0:1:423935].'; sig=[t,y1]; x=0; Lt=length(t); tx=10/423936*[0:1:423935].'; Ltx=length(tx); s=sin(4000*pi*tx); Mf=fftshift(fft(y1,Lt)); Sf=fftshift(fft(s,Ltx)); figure(1) subplot(211) plot(t,y1) xlabel('time,sec') title('My Voice'); subplot(212) plot(tx,s); xlabel('time,sec') title('Sinwave'); yt=s+y1; load H:\BWLPF.mat G SOS [b,a] = sos2tf(SOS,G) z1=filter(b,a,yt); load H:\BWHPF.mat q w [d,c] = sos2tf(w,q) z2=filter(d,c,yt); figure(2); subplot(311); plot(t,yt) xlabel('time,sec'); title('Recieved signal') subplot(312); plot(tx,z1); xlabel('time,sec'); title('Recieved signal after lowpass filter') subplot(313); plot(tx,z2); xlabel('time,sec'); title('Recieved signal after highpass filter') figure(3); subplot(211); plot(abs(Mf)); title('Message spectrum') subplot(212); plot(abs(Sf)); title('sinwave spectrum') 如題我想要將音檔用低通濾波器和高通濾波器繪出圖 但是結果卻是兩個都是白的 請問能幫我看一下程式碼有錯誤嗎? 感激不盡! -- ※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 140.135.32.184 ※ 文章網址: http://www.ptt.cc/bbs/MATLAB/M.1396866618.A.7D6.html

04/07 21:17, , 1F
z1 z2沒有定義
04/07 21:17, 1F
※ 編輯: CatEar (140.135.32.184), 04/07/2014 23:28:50 ※ 編輯: CatEar (140.135.32.184), 04/07/2014 23:31:47
文章代碼(AID): #1JGduwVM (MATLAB)