row deletion not working, can you help?

2 ビュー (過去 30 日間)
david ocallaghan
david ocallaghan 2019 年 4 月 25 日
回答済み: david ocallaghan 2019 年 4 月 26 日
%I have the following fft calc;
freqMin = 10;
freqCap = 50;
te = (time>=5.0);
fs = (length(time(te))-1)/(max(time(te))-min(time(te))); % fs = 1000
NFFTt = length(Ty(te));
Yt = fft(Ty(te),NFFTt);
freqt = ((0:1/NFFTt:1-1/NFFTt)*fs).'; % freqt = 0, 1.9960, 3.9920, ..., 998.004
ampt = abs(Yt);
fftArrayt = [freqt,ampt]
idxFreqCapt = find(freqt > freqCap & freqt < freqMin) % returns this -> 0×1 empty double column vector
fftArrayt(idxFreqCapt,:) = [] % returns this ->
% fftArrayt =
%
% 1.0e+03 *
%
% 0 0.8824
% 0.0020 0.9291
% 0.0040 0.7940
% 0.0060 0.4000
% ...
%
% Is it because it's looking at the rows and not seeing the *1000 so ignoring the delete rule?
% Can you help me delete freqt below 10 and above 50?

採用された回答

david ocallaghan
david ocallaghan 2019 年 4 月 26 日
% As I wanted to keep 10 < fftArrayt < 50, I replaced the logic with...
idxFreqCapt = find(freqt > freqCap);
idxFreqMint = find(freqt < freqMin);
idxFreqt = [idxFreqMint;idxFreqCapt]
fftArrayt(idxFreqt,:) = [];

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeStartup and Shutdown についてさらに検索

タグ

製品


リリース

R2016b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by