How to plot time vs displacement?

조회 수: 10 (최근 30일)
Shaun Labuschagne
Shaun Labuschagne 2020년 11월 6일
답변: akshata 2024년 6월 3일
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