How to plot only 80% of force displacement after peak from experiment data
1 次查看(过去 30 天)
显示 更早的评论
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 个评论
采纳的回答
Ben Mercer
2021-9-21
编辑:Ben Mercer
2021-9-21
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
更多回答(0 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!