ODE45 not updating a variable of nonlinear 2nd order diff.eq system
Mostra commenti meno recenti
Hello everyone, I was trying to solve a simple nonlinear system of diff.eqn (piece-wise linear) that involves coulomb friction. The problem I face is x(3) does not update after passing if condition... Although when i debug it, I can see that its varying accordingly... but at the end get a vector filled with a constant number(initial condition x3(0).) Could you please guide me how to cope with this issue???
function [dxdt]=func6(t,x)
C=10;
k=5;
kd=10;
F=25;
mu=0.5;
Nf=15;
m=1;
wn=sqrt(k/m);
w=wn;
fE=F*sin(w*t);
dxdt=zeros(size(x));
x1=x(1);
x2=x(2);
x3=x(3);
dxdt(1)=x(2);
%
nonlinear force calculation function
F_NL=kd*(x(1)-x(3));
if F_NL>=mu*Nf
F_NL=mu*Nf;
x(3)=x(1)-(mu*Nf)/kd;
end
if F_NL<=-mu*Nf
F_NL=-mu*Nf;
x(3)=x(1)+(mu*Nf)/kd;
end
dxdt(2)=1/m*(fE-F_NL-C*x(2)-k*x(1));
end
%%%and am using this script to run my ode calculations...
h=0.01;
tspan = 0:h:10;
initialvalues=[0 0 0];
[t,x]=ode23(@func6,tspan,initialvalues);
Risposta accettata
Più risposte (1)
Res
il 11 Set 2018
0 voti
Categorie
Scopri di più su Ordinary Differential Equations in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!