Solving non linear 2nd order differential equation
4 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Reuben Salisbury
le 7 Avr 2020
Commenté : Reuben Salisbury
le 7 Avr 2020
I am trying to solve the differential equation:
mx''+cx'+kx=ky+cy''
y is the input and x is the output.
y=Y0sin(wt)
where m=100, c=1300, k= 17000, Y0=input value, w=input value
initially I need to solve this, and then i need to plot displacement and velocity profiles.
clear
t=0:0.1:15; %time peroid
Y0= input('wave amplitude ') ; %Wave amplitude
l= input('length of wave ') ; %length of the wave
u=input('speed of boat'); %Boat Velocity
w=u/l; %frequency of wave
y=Y0*sin(w*t); %wave height model
Dr=0.5; %Required Damping Ratio
k=17000; %Spring Constant of suspension
m=100;
wn=(k/m)^0.5; %Natural Frequency
wd=wn*(1-Dr^2)^0.5; %Damped Natural Frequency
c=2*Dr*(k*m)^(0.5); %Damping coefficient
syms x(t)
ode=m*diff(x,t,2)+c*diff(x,t)+k*x==y+(2*Dr/wn)*diff(y,t);
xSol(t)=dsolve(ode);
0 commentaires
Réponse acceptée
Birdman
le 7 Avr 2020
Try this:
clear
syms t
Y0= input('wave amplitude ') ; %Wave amplitude
l= input('length of wave ') ; %length of the wave
u=input('speed of boat'); %Boat Velocity
w=u/l; %frequency of wave
y=Y0*sin(w*t); %wave height model
Dr=0.5; %Required Damping Ratio
k=17000; %Spring Constant of suspension
m=100;
wn=(k/m)^0.5; %Natural Frequency
wd=wn*(1-Dr^2)^0.5; %Damped Natural Frequency
c=2*Dr*(k*m)^(0.5); %Damping coefficient
syms x(t)
Dx(t)=diff(x,t);
ode=m*diff(x,t,2)+c*diff(x,t)+k*x==y+(2*Dr/wn)*diff(y,t);
xSol(t)=dsolve(ode,[x(0)==0 Dx(0)==0]);%displacement
DxSol(t)=diff(xSol,t);%velocity
t=0:0.05:15;
plot(t,xSol(t),t,DxSol(t))
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Numerical Integration and Differential Equations dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!