Is my ODE 45 function right?

2 visualizzazioni (ultimi 30 giorni)
Rui Wang
Rui Wang il 19 Nov 2019
Commentato: darova il 23 Nov 2019
Hello all, I am trying to solve the response of structure under tri-directional earthquake excitations using ODE 45. I have attached the code. I was wondering if my code is correct or not because the result is not good.
F=zeros(6001,3); % Earthquake excitation
F(:,1)=9.8*load('D:\CompatibleTH and Program\TH-RG160\LoValley_H1_compRG_acc.txt'); % 1st input point, 1st direction
F(:,2)=9.8*load('D:\CompatibleTH and Program\TH-RG160\LoValley_H2_compRG_sf_acc.txt'); % 1st input point, 2nd direction
F(:,3)=9.8*load('D:\CompatibleTH and Program\TH-RG160\LoValley_V_compRG_sf_acc.txt');% 1st input point, 3rd direction
global w a
for v=1:3
w=omega(v,v) % omega is a 3x3 matrix which has been solved before
for b=1:3
a=F(:,b);
[t, y]=ode45(@my_struc_fun_lanlan,[0:0.005:30],[0 0]);
q(:,b+3*(v-1))=y(:,1);
end
end
The defined function is as follows:
function [ f ] = my_struc_fun_lanlan( t,y)
global w a
gt=[0:0.005:30]';
A=[0,1;-w^2,-2*0.05*w];
g1=0;
g2=interp1(gt,a,t); % interprate the input data at time t
g=[g1;g2];
f=A*y-g;
% f=zeros(2,1);
% f(1)=y(2);
% f(2)=-w^2*y(1)-2*0.05*w*y(2)-g2;
end
ANY help would be very appreciated. Thank you.
  3 Commenti
Rui Wang
Rui Wang il 23 Nov 2019
Hi Darove,
The original DE is attached. Thank you.
darova
darova il 23 Nov 2019
Looks ok. WHy do you think the result is incorrect?

Accedi per commentare.

Risposte (0)

Categorie

Scopri di più su Seismology in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by