Show time evolution of an hysteresis loop with color gradient
Mostra commenti meno recenti
I introduced a slider in my sdof model and I'm trying to show the evolution over time of the hysteresis loop ( x axis: displacement, y axis: friction force), to do so I tried to make a 3d plot but it is not really helpful, I tried to animate the plot but it slows down the code, so I thought of using a color gradient; the problem is that most of the 'interesting' parts of the hysteresis loop happen in a relatively small intervall of the entire time vector and the colormap shows everything of the same color (almost) and it is not really clear. How can I solve this problem? I would like to manipulate the colormap in way that allows me to better represent the difference in time istants even if they are closely spaced.

Code snippet:
rel_disp = downsample((x).', 10);
FJ = downsample((kJ(j).*yJ).', 10);
n = numel(yJ);
Z_dt = t_end/n;
t = (0:Z_dt:t_end);
t(end) = [];
t = downsample(t, 10);
patch([rel_disp nan], [FJ nan], [t nan], 'Edgecolor', 'Interp', ...
'Linewidth', 0.90);
cmap = 'lines';
colormap(cmap);
colorbar;
xlabel('Displacement x [m]');
ylabel('Jenkins element force [N]');
title('Force-displacement hysteretic loop');
ax = gca;
ax.XMinorTick = 'on';
ax.YMinorTick = 'on';
ax.XMinorGrid = 'on';
ax.YMinorGrid = 'on';
if kJ(j) ~= 0
xlim([min(rel_disp) max(rel_disp)]);
ylim([min(FJ) max(FJ)]);
end
hold on
1 Commento
dpb
il 8 Nov 2025
You forgot to attach the data and enough code to allow somebody to reproduce the plot.
As far as ideas, perhaps an inset plot that zooms into the area of interest?
Alternatively, it would take making the colormap nonlinear with the response to increase the change in color more drastically than the change in the response in order for there to be a larger color gradient. That might be visually pleasing, but it also might distort the perception of the actual data. I suppose one could manipulate the colorbar labels to match.
Although on closer observation, it appears the colorbar is log scale as is; changing to linear would amplify the changes.
Risposta accettata
Più risposte (0)
Categorie
Scopri di più su Blue in Centro assistenza e File Exchange
Prodotti
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!



