필터 지우기
필터 지우기

1D Newmark Using Matlab

조회 수: 5 (최근 30일)
nur yusof
nur yusof 2016년 1월 21일
댓글: Chaudhary P Patel 2022년 11월 29일
Hi,
I am trying to solve example 5.1 in dynamic structure book by Anil K.Chopra page 168. But, I have a problem with the Matlab coding. Following are my coding:-
clc
m=0.2533;
k=10;
c=0.1592;
gam = 1/2 ;beta = 1/6 ;
%Initial Calculation
po=0;
u0=0;
udot0=0;
u2dot1 = 1/m*(po-k*u0-c*udot0);
% Time step
ti = 0. ;
tf = 4. ;
dt = 0.1 ;
t = ti:dt:tf ;
nt = fix((tf-ti)/dt) ;
kcap = k + gam/(beta*dt)*c + m/(beta*dt^2);
a = m/(beta*dt) + gam*c/beta;
b = 0.5*m/beta + dt*(0.5*gam/beta - 1)*c;
dp = diff(p);
for i = 1:nt
deltaP = dp(i) + a*udot(i) + b*u2dot(i);
du_i = deltaP/kcap;
dudot_i = gam/(beta*dt)*du_i - gam/beta*udot(i) + dt*(1-0.5*gam/beta)*u2dot(i);
du2dot_i = 1/(beta*dt^2)*du_i - 1/(beta*dt)*udot(i) - 0.5/beta*u2dot(i);
u(i+1) = du_i + u(i);
udot(i+1) = dudot_i + udot(i);
u2dot(i+1) = du2dot_i + u2dot(i);
end
When i run the coding this warning appear
Undefined function or variable 'p'.
Error in (line 25)
dp = diff(p);
Why it happen and how to solve the problem?
Thank you.
  댓글 수: 2
nur yusof
nur yusof 2016년 1월 21일
편집: nur yusof 2016년 1월 21일
Sorry.Attached the print screen of the question.
The example must be solved by using Newmark method. Given dt=0.1, m=0.2533, k=10, c=0.1592, u0=0,u0dot=0,p0=0 Hope anyone can help out.
Chaudhary P Patel
Chaudhary P Patel 2022년 11월 29일
@nur yusof can you share the solution of this problem?

댓글을 달려면 로그인하십시오.

답변 (1개)

Walter Roberson
Walter Roberson 2016년 1월 21일
Poking around it appears likely that you are referring to "Dynamics of Structures: Theory and Application to Earthquake Engineering" by Anil K. Chopra, chapter 5, 5.1 Time-Stepping Methods . However you have not indicated which edition, with 4 known numbered editions, and with one named "International Edition". Or perhaps you are referring to "Dynamics of Structures: A Primer" by Anil K. Chopra, or to "Earthquake Dynamics of Structures: A Primer" by Anil K. Chopra and Barbara Zeiders.
The first of those has the most supporting evidence, but the edition matters because there might have been an error that got corrected in later versions.
Or if they do not give code in the book, then the error is in your introduction of p without defining it.
Have you considered using the implementation in the File Exchange ?

카테고리

Help CenterFile Exchange에서 Earthquake Engineering에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by