plese help someone.I need to solve simultaneous differential eqns with multiple dependent variable.

2 views (last 30 days)
ajeet sahu
ajeet sahu on 5 Sep 2021
Commented: Paul on 6 Sep 2021
here is what I written to solve these eqns. I'm getting error.I don't have any initial conditions.Also I need to plot y1,y2 and y3.I'm still learning matlab and don't have idea how to solve this problem.
clc;clear;close;
%write given values
m1=1; m2=2; m3=3;
c1=3; c2=1;
k1=2; k2=2;
f1=5; f3=2;
%call the function named 'func'
[y1 y2 y3]=func(m1,m2,m3,c1,c2,k1,k2,f1,f3)
function [y1 y2 y3] =
func(m1,m2,m3,c1,c2,k1,k2,f1,f3)
%define variables
syms y1(t) y2(t) y3(t)
%write differential equations
eqn1=m1*diff(y1,t,2)==f1-c1*(diff(y1,t)-diff(y2,t))-k1*(y1-y2);
eqn2=m2*diff(y2,t,2)==-c1*(diff(y2,t)-diff(y1,t))-k1*(y2-y1)-c2*(diff(y2,t)-diff(y3,t))-k2*(y2-y3);
eqn3=m3*diff(y3,t,2)==-f3-c2*(diff(y3,t)-diff(y2,t))-k2*(y3-y2);
%solve these eqns
y = dsolve(eqn1,eqn2,eqn3);
y1=y.y1;
y2=y.y2;
y3=y.y3;
end
  6 Comments
Paul
Paul on 6 Sep 2021
I was able to get Matlab to return an expression in terms of roots(), and I assumed that if a closed form for those roots existed Matlab would have provided it.

Sign in to comment.

Answers (0)

Categories

Products


Release

R2021a

Community Treasure Hunt

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

Start Hunting!