How to plot time vs displacement?

10 次查看(过去 30 天)
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.

采纳的回答

KSSV
KSSV 2020-11-6
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 个评论
Shaun Labuschagne
Shaun Labuschagne 2020-11-7
I want to produce the values at each time step aswell, how would I set up a loop to do this?
KSSV
KSSV 2020-11-7
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)

请先登录,再进行评论。

更多回答(1 个)

akshata
akshata 2024-6-3
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)

类别

Help CenterFile Exchange 中查找有关 MATLAB 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by