solving odes that matrices should be update in every step.

2 ビュー (過去 30 日間)
masoud azar
masoud azar 2020 年 1 月 13 日
コメント済み: darova 2020 年 1 月 18 日
Hi.I have a question that may be so elementary but so far I haven't found a solution. please if it is possible guide me.
i want to solve the 2nd order diffrential equation for vibration of 3DOF system.the equation is : [m]*{x"} + [C]*{x'} + [K]*{X} = -[M]*{r} d2g/dt2
that M is mass matrix . K , C are stiffness and damping matrices that should be update in every time step.also {r} = [ 0;0;1] and g" is the time-dependent external acceleration.(earthquake records).
for updating K and C matrices,i wrote a cod in matlab contains a for-loop that in every time step (=0.5 second) first update [K] and [C] matrices and then use ode45 to solve equation for time span=0.5 second.but i get suspicious result.for example ode45 output for every time span=0.5 second outputs a 61*1 vector but i think output should be a 6*1 vector like this : [x1; x'1; x2; x'2 ;x3;x'3]
can you tell me where is the problem? maybe i use ode45 in wrong method.
i attach my code to this question.
thank you for your help.

回答 (1 件)

darova
darova 2020 年 1 月 13 日
I made some changes in your code. Pay attention to refreshing parameters:
function sdot = ODEFUN(t,x)
g1 = interp1(TIME,G,t);
ag1 = interp1(TIME,AG,t);
%% ...
end
Also i didn't refresh C and K matrices (don't know how)
See attached file
  10 件のコメント
masoud azar
masoud azar 2020 年 1 月 18 日
thank you darova and Walter Roberson.
at the moment i am trying to edit and rewrite the matlab code in both methods based on your comments and compare the output results in same inputs.
finally i will report the results here.
i am beginer in matlab and it may take a time.
darova
darova 2020 年 1 月 18 日
I will be here, waiting

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeProgramming についてさらに検索

製品


リリース

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by