I need to isolate certain values of a matrix based on whether one of the values fall in a certain range
% ans = 2×2 % 24.9843526628176 32 % 5.44020124026728 62
function FINAL_OUTPUT = FFT_Output(OG_Audio, Filter_count, Min_peak_distance) % Setup Sectional_Length = round(length(OG_Audio)/4); BM_Filtered_Signal = (blackman(length(OG_Audio))).*OG_Audio; First_Filter_Parameter = ((1/(Sectional_Length/100))*ones(1,(Sectional_Length/100))); Word_section = cell(4,1); FFT_Word = cell(4,1); FINAL_OUTPUT = cell(4,1); for i = 1:4 % Word sections Word_section{i} = BM_Filtered_Signal(((Sectional_Length*(i-1))+1):(Sectional_Length*i)); % Moving average filter j=0; while(j<=Filter_count) Word_section{i} = filter(First_Filter_Parameter, 1, Word_section{i}); j=j+1; end % FAST FOURIER TRANSFORM FFT_Word{i} = abs(fft(Word_section{i},length(Word_section{i}))); FFT_Word{i} = FFT_Word{i}(1:(round(length(FFT_Word{i})/(2)))); % Peak detection [M,I] = findpeaks(FFT_Word{i}, "MinPeakDistance",Min_peak_distance, "MinPeakHeight",(0.1*max(FFT_Word{i}))); % Identifying peak frequencies for comparisons FINAL_OUTPUT{i} = [M,I]; end end
NOTE:-
Matlabsolutions.com provide latest MatLab Homework Help,MatLab Assignment Help , Finance Assignment Help for students, engineers and researchers in Multiple Branches like ECE, EEE, CSE, Mechanical, Civil with 100% output.Matlab Code for B.E, B.Tech,M.E,M.Tech, Ph.D. Scholars with 100% privacy guaranteed. Get MATLAB projects with source code for your learning and research.
Here's a general approach - Discretize the data according to the groups and then split then into cells.
bins = 0:30:300; idx = discretize(data, bins) out = splitapply(@(x) {x}, data, idx)
SEE COMPLETE ANSWER CLICK THE LINK
Comments
Post a Comment