Hi guys,
I have another question again. If you run the script which I have attached, you will get a graph and few calculations.
What I want to do is: I need to know after how many seconds the graph reaches 50% and 90% of its maximum.
I have come this far: My idea was it, to take the piece of the curve where the gradient is zero to calculate the average for 100%. From this value I would calculate the 50% and 90%. Because this values are calculated I won't find exactly them, so I'm searching for the next smaller and next bigger value. Now I would need the time, how long it took to get to 50% and to 90%.
I need to do this for 12 graphs to get more or less good average values. Can you please tell me if there is a better/easier way to get the result, or is my way ok? And how would you solve it for several graphs.
Thank you very much!
% Load cell array
load('c_test.mat');% Take timetable from cell array
P1_100 = c{1}(100:end,1:1);% Convert timetable to matrix
P1_100_T = timetable2table(P1_100);P1_100_T = P1_100_T{:,2:2};% Calculate the average for 100%
P1_100_av = mean(P1_100_T(:,:));% Calculate 50% and 90%
P1_50 = P1_100_av*0.5;P1_90 = P1_100_av*0.9;% Load data for full curve
P1 = c{1}(:,1:1);% Interpolate timetable and set the starttime at zero
dt = milliseconds(100);IP1 = retime(P1,'regular','linear','TimeStep', dt);StartTime = datetime('05.07.2019 00:00.000', 'InputFormat', 'dd.MM.yyyy mm:ss.SSS');IP1.Properties.StartTime = StartTime;scatter(IP1.Time, IP1.Volt);% Convert interpolated timetable to matrix
IPM1 = timetable2table(IP1);IPM1 = IPM1{:,2:2};% Search for next smaller and next bigger value of 50%
P1_50_uG = IPM1(find(IPM1 < P1_50, 1, 'last'));P1_50_oG = IPM1(find(IPM1 > P1_50, 1, 'first'));% Search for next smaller and next bigger value of 90%
P1_90_uG = IPM1(find(IPM1 < P1_90, 1, 'last'));P1_90_oG = IPM1(find(IPM1 > P1_90, 1, 'first'));
Best Answer