資源簡介
matlab加窗程序,包括矩形窗、三角窗、漢明、漢寧窗、高斯窗等,還有干涉圖的生成,傅里葉變換
代碼片段和文件信息
%%?模擬干涉圖并進行不同窗函數切趾處理,再對處理結果進行傅里葉變換求光譜
clc;
clear;
close?all;
fs?=?100;?
N?=?512;?
t?=?(0:N-1)/fs;????%采樣頻率?采樣點數?采樣時間序列s
a?=?10;
w?=?2;?
x0?=?a*cos(2*pi*w*t);
xf0?=?2*abs(fft(x0));??%?如此處理,可以看到信號原來真實的幅度
xf0?=?fftshift(xf0);??%將xf以y軸做對稱,即將數據左右互換
figure;
subplot(211);
plot(x0);
xlim([0?512]);
title(‘模擬原始干涉圖‘);
subplot(212);
plot(xf0);
xlim([0?512]);
title(‘未切趾‘);
%%?切趾函數
figure;
window1=?boxcar(N);?
[h1w]=freqz(window11);?
subplot(311);??
stem(window1);?%畫窗函數
axis([0?520?0?2]);?
grid;?
xlabel(‘N‘);??
title(‘矩形窗函數‘);?
window2=?triang(N);?
[h2w]=freqz(window21);?
subplot(312);??
stem(window2);?%畫窗函數
axis([0?520?0?2]);
grid;?
xlabel(‘N‘);??
title(‘三角窗函數‘);?
window3=?hanning(N);?
[h3w]=freqz(window31);?
subplot(313);??
stem(window3);?%畫窗函數
axis([0?520?0?2]);
grid;?
xlabel(‘N‘);??
title(‘漢寧窗函數‘);
figure;
window4=?hamming(N);?
[h4w]=freqz(window41);?
subplot(311);??
stem(window4);?%畫窗函數
axis([0?520?0?2]);
grid;?
xlabel(‘N‘);??
title(‘漢明窗函數‘);
window5=?blackman(N);?
[h5w]=freqz(window51);?
subplot(312);??
stem(window5);?%畫窗函數
axis([0?520?0?2]);
grid;?
xlabel(‘N‘);??
title(‘布拉克曼窗函數‘);
window6=?gausswin(N);?
[h6w]=freqz(window61);?
subplot(313);??
stem(window6);?%畫窗函數
axis([0?520?0?2]);
grid;?
xlabel(‘N‘);??
title(‘高斯窗函數‘);
%%?切趾后干涉圖
x1=window1‘.*x0;
x2=window2‘.*x0;
x3=window3‘.*x0
- 上一篇:自適應模糊控制matlab實現
- 下一篇:MATLAB中小波用于檢測奇異點
評論
共有 條評論