stick slip code for matlab

Problem plotting stick slip graph with this code, where am I going wrong?
[t,y] = ode45(@Stick_Slip,[0:0.01:10],[0.01; 0]);
figure
plot( y(:,1),y(:,2) )
xlabel( 'Position' )
ylabel( 'Velocity' )
title('Stick-Slip');
function dy = Stick_Slip(t,y)
m = 1;
k = 100;
V = 0.5;
Mu=0.5;
c = 2;
f = c*y(2) + k*y(1);
if f <= Mu*m*9.81
dy(1,1) = V;
dy(2,1) = 0;
else
dy(1,1) = y(2);
dy(2,1) = (f - k*y(1) - c*y(2)) / m;
end
end

3 commentaires

John D'Errico
John D'Errico le 4 Mar 2020
And your question is what? The mind reading toolbox is fuzzy today,so we need for you to tell us what is on your mind.
Milind Khanna
Milind Khanna le 4 Mar 2020
I am actually having problem in plotting the graph showing stick slip but I am not getting the desired output with the above code. Could you tell where I am doing the mistake?
Thank you.
venkatesu u
venkatesu u le 12 Juin 2023
Déplacé(e) : DGM le 12 Juin 2023
Show me the Stick_Slip function

Connectez-vous pour commenter.

Réponses (0)

Produits

Version

R2019a

Déplacé(e) :

DGM
le 12 Juin 2023

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by