Findpeaks from the excel data graph
3 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Harsimranjot Grewal
il 27 Mag 2021
Risposto: Star Strider
il 27 Mag 2021
Hello Everyone,
I am trying to find the peak from the certain range on my x axis but its not working and giving me the error "Arrayindisices must be positive intergers or logical values".I am atatching the code and excel file as follow.Any help would be appreciated. Thanks in advance.
clc
Data = xlsread('test.xlsx');
%% Step 2 data
x2 =Data(655:8466,6); % Sample temprature
y2 =Data(655:8466,3); % Umsubstracted temprature
figure
plot(x2,y2);
set(gca,'ydir', 'reverse')
title('Step 2 Data')
hold on
%% Peak for step 2
J = x2(x2>90 & x2<120);
[pks, locs] = findpeaks((x2(J)),'Npeaks',1)
0 Commenti
Risposta accettata
Star Strider
il 27 Mag 2021
To create a logical vector for ‘J’, just do:
J = (x2>90 & x2<120);
Then the reference to it works correctly.
However there are no peaks in that region (at least that findpeaks identifies as peaks).
% C1 = readcell('https://www.mathworks.com/matlabcentral/answers/uploaded_files/632270/test123.xlsx');
T1 = readtable('https://www.mathworks.com/matlabcentral/answers/uploaded_files/632270/test123.xlsx','VariableNamingRule','preserve')
x2 = T1{655:8466,6}; % Sample temprature
y2 = T1{655:8466,3}; % Umsubstracted temprature
figure
plot(x2,y2);
set(gca,'ydir', 'reverse')
title('Step 2 Data')
hold on
%% Peak for step 2
J = (x2>90 & x2<120);
[pks, locs] = findpeaks((x2(J))),'Npeaks',1)
.
0 Commenti
Più risposte (0)
Vedere anche
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!