matlab people helo hellp

i don't know what to say

1 Comment

Stephen23
Stephen23 on 7 Dec 2021
Edited: Stephen23 on 7 Dec 2021
Original question by Constantine Kenny retrieved from Google Cache:
Convert time series for acceleration to displacement using ode45
I have data for ground motion acceleration as a function of time. I would like to convert this acceleration data to displacement data using matlab's ode45 function. Is this possible, and is this the right way to do so?
The differential equation is:
ẍ(t) + 2ζνẋ(t) + (v^2)*x(t) = -a(t)
where a(t) is the acceleration time series that I have.

Sign in to comment.

Answers (1)

It appears that ζ anc v are constants. Are they known and provided or are they to be estimated?
Assuming they are provided —
syms a(t) t v x(t) Y zeta
D1x = diff(x);
D2x = diff(D1x);
DE = D2x + 2*zeta*v*D1x + v^2*x + a
DE(t) = 
[VF,Sbs] = odeToVectorField(DE)
VF = 
Sbs = 
odefcn = matlabFunction(VF, 'Vars',{'t','Y','v','zeta','a'})
Warning: Function 'a' not verified to be a valid MATLAB function.
odefcn = function_handle with value:
@(t,Y,v,zeta,a)[Y(2);-a(t)-v.^2.*Y(1)-v.*zeta.*Y(2).*2.0]
v = 4.2;
zeta = 0.42;
t = linspace(0, 50, 15);
a = randn(size(t))*10; % Acceleration Values Vector
aintp = @(tv) interp1(t, a, tv); % Interpolate Data
ic = [0 2]; % Use Appropriate Values
[t,y] = ode45(@(t,y)odefcn(t,y,v,zeta,aintp), t, ic);
figure
plot(t, y)
grid
xlabel('t')
ylabel('Amplitude')
legend(string(Sbs), 'Location','best')
Seismology is not an area of my expertise, so make appropriate changes (and use the correct parameter values) to get the desired results.
.

Categories

Find more on Data Import and Analysis in Help Center and File Exchange

Asked:

on 30 Nov 2021

Edited:

on 7 Dec 2021

Community Treasure Hunt

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

Start Hunting!