How to plot only 80% of force displacement after peak from experiment data
1 view (last 30 days)
Show older comments
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.
Thanks in advance
0 Comments
Accepted Answer
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
More Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!