Skip to content

Example for stick slip friction model#51

Open
LuMarv wants to merge 7 commits intopublicfrom
filExample
Open

Example for stick slip friction model#51
LuMarv wants to merge 7 commits intopublicfrom
filExample

Conversation

@LuMarv
Copy link
Collaborator

@LuMarv LuMarv commented Feb 17, 2026

Adds a frction model example to the examples library with two different formulations (filippov and non-filippov). Compares both versions in accuracy and is suited for comparison of sensitivities (needs to be implemented)

Copy link
Collaborator

@Schlevidon Schlevidon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! There are a few things that could be improved.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What has changed in this file? Was the change intentional?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

restored old version

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What has changed in this file? Was the change intentional?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

restored old version

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What has changed in this file? Was the change intentional?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

restored old version

function res = F_fric_no_fil(x, mu_rel, epsilon, F_s, k, delta)
if mu_rel <= -epsilon
res = F_s / (1 - delta * mu_rel);
%res = -F_s * mu_rel;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this commented out code necessary? If not, remove it.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Resolved

else
if mu_rel >= epsilon
res = (-F_s) / (1 + delta * mu_rel);
%res = -F_s * mu_rel;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this commented out code necessary? If not, remove it.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Resolved


figure(500); box on;
subplot(2, 2, 1);
scatter(T, Gy11, 'LineWidth', 0.5, 'Color', [0, 0.5, 0], Marker='.'); hold on;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is a scatter plot used here? Why not a regular plot (with markers if necessary)?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It was used because of the jumps in the sensitivities

Comment on lines +176 to +177
fildiff1 = abs(Y_filippov(1,:) - Y_no_fil(1,:));
fildiff2 = abs(Y_filippov(2,:) - Y_no_fil(2,:));
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why split up the rows into two separate variables? Could just compute abs on the whole matrix, then select the rows when plotting.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

condensed!

grid on;
set(gca, 'FontSize', 12, 'LineWidth', 1.2);

warning('on', 'IFDIFF:chattering'); No newline at end of file
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If any preceding code throws, this will not be executed and the warning state will not be restored. Also, we should restore the same warning state as before (don't assume that the warning was set to 'on' before).

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added try catch blocks to prevent this and script now remembers initial warning status

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add the paper this model was taken from as a source in a comment at the beginning (see pprhs.m for an example).

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add the paper this model was taken from as a source in a comment at the beginning (see pprhs.m for an example).

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added to the main script as both variants are found in this same source.

Marvin added 6 commits March 3, 2026 12:05
	new file:   toolbox/examples/friction_model/friction_model_RHS.m
	new file:   toolbox/examples/friction_model/friction_model_test.m
	modified:   toolbox/examples/liveExamples/canonicalExRHS_test_live.mlx
	new file:   toolbox/examples/friction_model/F_fric_mod.m
	new file:   toolbox/examples/friction_model/F_fric_mod2.m
	new file:   toolbox/examples/friction_model/friction_model_RHSmod.m
	new file:   toolbox/examples/friction_model/friction_model_RHSmod2.m
	new file:   toolbox/examples/friction_model/friction_model_mod_test.m
	modified:   toolbox/examples/liveExamples/CanonicalSensitivities.mlx
	deleted:    toolbox/examples/friction_model/F_fric.m
	renamed:    toolbox/examples/friction_model/friction_model_RHSmod.m -> toolbox/examples/friction_model/friction_RHS_filippov.m
	renamed:    toolbox/examples/friction_model/friction_model_RHSmod2.m -> toolbox/examples/friction_model/friction_RHS_no_filippov.m
	deleted:    toolbox/examples/friction_model/friction_model_RHS.m
	renamed:    toolbox/examples/friction_model/friction_model_mod_test.m -> toolbox/examples/friction_model/friction_model_comparison.m
	deleted:    toolbox/examples/friction_model/friction_model_test.m
	renamed:    toolbox/examples/friction_model/F_fric_mod2.m -> toolbox/examples/friction_model/helpers/F_fric_fil.m
	renamed:    toolbox/examples/friction_model/F_fric_mod.m -> toolbox/examples/friction_model/helpers/F_fric_no_fil.m
	modified:   toolbox/examples/friction_model/friction_model_comparison.m
	modified:   toolbox/examples/friction_model/helpers/F_fric_no_fil.m
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants