How to plot only 80% of force displacement after peak from experiment data

2 views (last 30 days)
Rajan Maharjan on 21 Sep 2021
Commented: Rajan Maharjan on 22 Sep 2021
I have force and displacment data from experiment and I would like to plot only 80% of force after the peak force, ( star marked in attached figure). Please help me with suitable idea. I am quite new in matlab.

Ben Mercer on 21 Sep 2021
Edited: Ben Mercer on 21 Sep 2021
Hi Rajan,
I would do this via interpolation. Interpolation only works on data for which the independent variable is monotonic, whereas you are looking at a parametric curve which folds back on itself. If you find the location of the peak force, you can truncate the plot to only include the portion of the curve after the peak, then apply interpolation to the truncated segment of your curve.
Try the code below, subbing in your own variable names obviously:
% Find the location and magnitude of the maximum force
[maxForce, idx] = max(force);
% Truncate to just the portion of the curve after the maximum force, which
% will be descending
force_descending = force(idx:end);
displacement_descending = displacement(idx:end);
% Force monotony of the truncated curve (note, unique removes duplicates
% AND sorts)
[force_descending, IA] = unique(force_descending);
displacement_descending = displacement_descending(IA);
% Determine the location of the 80% of maximum force point
force_80 = 0.8 * maxForce;
displacement_80 = interp1(force_descending, displacement_descending, force_80);
% Plot the point on
hold on
plot(displacement_80, force_80, '+', 'displayname', '80% of peak force')
legend
Rajan Maharjan on 22 Sep 2021
thanks so much
/Rajan