clc clear all close all syms t M=2; B=1; C=3; K=6; f=2*exp(-t); q0=1; qd0=-1; qd20=1; alpha=1/2; beta=1/12; gamma=1/4; h=0.1; Tf=2; [T,q]=Newmark3(M,B,C,K,f,q0,qd0,qd20,alpha,beta,gamma,h,Tf); plot(T,q,'r-o','linewidth',1.5) hold on ezplot('exp(-t)',[0 Tf]) legend('\it\bfNewmark','\it\bfExact') title('')