How to plot time vs displacement?

10 vues (au cours des 30 derniers jours)
Shaun Labuschagne
Shaun Labuschagne le 6 Nov 2020
Hi i'm not great at coding on MATLAB and need help to to find the dynamic response to a 5 DOF system with intitial displacments (velocity = 0) over a certain time period. I need to find the minimum and maximum displacements of a specific node in this time period. There is no damping.
The equation is in the form Ut = @(t) A1*cos(w1*t) + A2*cos(w2*t) + A3*cos(w3*t) + A4*cos(w4*t) +A5*cos(w5*t) where Ai is a 5x1 vector and w are the natural frequency constants.
u0 = [u1; u2; u3; u4; u5] is the initial displacement at each node
udot0 = 0
t0 = 0 start time
tf = 779.3 end time
dt = 7.1 time increment
How would I program this so that I get the values at each node for each time step and then get the maximum and minimum value for one of the nodes? Is there a way to simulate the system visually on matlab?
Sorry to be vague, I am just wanting tips for a novice.

Réponse acceptée

KSSV
KSSV le 6 Nov 2020
Demo EXample:
t0 = 1 ; t1 - 10; dt = 0.01 ;
u = @(w,t) = cos(w*t) ;
t = t0:dt:t1 ;
w = 2*pi ;
s = u(w,t) ;
plot(t,s)
  2 commentaires
Shaun Labuschagne
Shaun Labuschagne le 7 Nov 2020
I want to produce the values at each time step aswell, how would I set up a loop to do this?
KSSV
KSSV le 7 Nov 2020
t0 = 1 ; t1 - 10; dt = 0.01 ;
u = @(w,t) = cos(w*t) ;
t = t0:dt:t1 ;
w = 2*pi ;
n = length(t) ;
s = zeros(1,n) ;
for i = 1:n
s(i) = u(w,t(i)) ;
end
plot(t,s)

Connectez-vous pour commenter.

Plus de réponses (1)

akshata
akshata le 3 Juin 2024
t0 = 1 ; t1 - 10; dt = 0.01 ;
u = @(w,t) = cos(w*t) ;
t = t0:dt:t1 ;
w = 2*pi ;
n = length(t) ;
s = zeros(1,n) ;
for i = 1:n
s(i) = u(w,t(i)) ;
end
plot(t,s)

Catégories

En savoir plus sur MATLAB 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!

Translated by