[問題] fft圖問題已回收
小弟目前有2筆數據一個是對時間一個是量測數據
已將之轉成FFT圖但是目前如果我只要單獨取出某一段的頻率來作IFFT
其餘的部份均要把它的數據改寫成0,那麼程式應該要怎麼寫呢
爬文爬了很久想不出來,請大大幫幫忙,感謝
以下是我原本的程式碼
clc; clear;
data2=load('hr1.txt');
time2=load('ht1.txt');
N=length(time2);%取樣數
fs=1/0.069;%取樣頻率
freq=(0:N-1)*(fs/N);%頻率軸刻度
yp=fft(data2);
y_new=ifft(yp);
subplot(3,1,1);
plot(time2,data2, '-');
grid on
xlabel('Time (hr)'); ylabel('Water(m)');
axis tight
subplot(3,1,2);
plot(freq,yp, '-b'); grid on
xlabel('Frequency');
ylabel('Magnitude');
subplot(3,1,3);
plot(time2,y_new, '-');
grid on
xlabel('Time (hr)'); ylabel('Water(m)');
axis tight
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 192.83.195.235
MATLAB 近期熱門文章
PTT數位生活區 即時熱門文章