問候的頻率全部增加信號
我回去,並使用resample(從信號處理工具箱)和repmat,但我注意到,在一些的值的行是不一樣的樣品率,請參閱下面的圖片鏈接。請注意行的頂部圖像值爲1000,底部圖像爲rows = 1008。這發生在我更改resample和repmat(freq_new)的值時,但僅限於某些值。我如何正確解決這個問題?我可以在1000之後刪除所有東西,但我不確定這是一個錯誤還是隻是resample/repmat的工作方式。 PS:使用MATLAB /八度
這裏的測試代碼我用來測試這個
%resample_repmat signal
clear all, clf
Fs = 1000; % Sampling rate
Ts = 1/Fs; %sampling interval
t=0:Ts:1-Ts; %sampling period
freq_orig=1;
y=sin(2*pi*t*freq_orig)'; %gives a short wave
freq_new=9;
y2=resample(y,1,freq_new); %resample matrix
y3=repmat (y2,freq_new,1); %replicate matrix
[r_orig,c_orig] = size(y) %get orig number of rows and cols
[r_new,c_new] = size(y3) %get new number of rows and cols
subplot(2,1,1),plot(y),title('Orginal signal')
title(['rows=',num2str(r_orig),' cols=',num2str(c_orig)])
subplot(2,1,2),plot(y3),title('New signal')
title(['rows=',num2str(r_new),' cols=',num2str(c_new)])
在你前面的問題中留言,你說你想要的所有頻率分量的*線*轉變,但重採樣這樣會給你一個*日誌*頻移,即每個組件的頻移量將與每個組件的原始頻率成比例。 – 2011-04-07 16:47:33