1. Trang chủ
  2. » Kỹ Thuật - Công Nghệ

Advanced Mathematics and Mechanics Applications Using MATLAB phần 10 pdf

66 417 0

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Định dạng
Số trang 66
Dung lượng 309,15 KB

Các công cụ chuyển đổi và chỉnh sửa cho tài liệu này

Nội dung

Appendix AList of MATLAB Routines with Descriptions Table A.1: Description of MATLAB Programs and Selected Functions map-ping of a circular disk inside a square.. smdsolve 2 Function to

Trang 1

148: num2str(dbest),’, CPU TIME = ’,

149: num2str(t),’ SECS’])

150: rotate3d on, shg, disp(’ ’)

151: disp(’Rotate the figure or press’)

162: % This function computes the position of a

163: % point on the surface of a circular cylinder

164: % arbitrarily positioned in space The argument

165: % list parameters have the following form,

166: % where rad means cylinder radius, and len

167: % means cylinder length

186: % This function computes the square of the

187: % distance between generic points on the

188: % surfaces of two circular cylinders in three

189: % dimensions

Trang 2

204: % This function plots the geometries

205: % pertaining to four data cases used

206: % to test closest proximity problems

207: % involving two circular cylinders

Trang 3

243: hold off, subplot

244: % print -deps cylclose

253: % This function generates point grids on the

254: % surfaces of two circular cylinders and plots

255: % both cylinders together

Trang 4

285: % surface of a circular cylinder

307: % This function generates approximately N

308: % points between min(u) and max(u) including

309: % all points in u plus additional points evenly

310: % spaced in each successive interval

311: % u - vector of points

312: % N - approximate number of output points

314: % v - vector of points in increasing order

Trang 5

328: % This function generates a rotation matrix

329: % having v(:)/norm(v) as the third column

341: % This function performs multidimensional

342: % unconstrained function minimization using the

343: % direct search procedure developed by

344: % J A Nelder and R Mead The method is

345: % described in various books such as:

346: % ’Nonlinear Optimization’, by M Avriel

347: %

356: % epsx - convergence tolerance on x

357: % epsf - convergence tolerance on

361: % ifpr - when this parameter equals one,

364: % varargin - variable length list of parameters

366: % xmin - coordinates of the smallest

368: % fmin - smallest function value found

Trang 6

375: % shrinkages performed

376: %

377: % User m functions called: objective function

379:

380: if isempty(ifpr), ifpr=0; end

381: if isempty(M), M=500; end;

382: if isempty(epsf), epsf=1e-5; end

383: if isempty(epsx), epsx=1e-5; end

396: alpha=1.0; % Reflection coefficient

397: beta= 0.5; % Contraction coefficient

398: gamma=2.0; % Expansion coefficient

406: % Exit if maximum allowable number of

407: % function values is exceeded

408: if m>M, xmin=x(:,1); fmin=f(1); return; end

Trang 7

418: % Expand and take best from expansion

437: % Reflected point exceeds the second

438: % highest value so either use contraction

Trang 8

482: % This function determines the closest points on two

483: % surfaces and the distance between these points It

484: % is similar to function srf2srf except that large

485: % arrays can be processed

486: %

487: % x,y,z - arrays of points on the first surface

488: % X,Y,Z - arrays of points on the second surface

490: % r,R - vectors containing the coordinates of the

Trang 9

520: % This function determines the closest points on two

521: % surfaces and the distance between these points

522: % x,y,z - arrays of points on the first surface

523: % X,Y,Z - arrays of points on the second surface

525: % r,R - vectors containing the coordinates of the

528:

529: x=x(:); y=y(:); z=z(:); n=length(x); v=ones(n,1);

530: X=X(:)’; Y=Y(:)’; Z=Z(:)’; N=length(X); h=ones(1,N);

Trang 10

555: % xn,yn,zn)

556: % See Appendix B

Trang 11

Appendix A

List of MATLAB Routines with Descriptions

Table A.1: Description of MATLAB Programs and Selected Functions

map-ping of a circular disk inside a square.

smdsolve 2 Function to solve a constant coefÞcient

linear second order differential tion with a harmonic forcing function.

string with given initial deßection.

Trang 12

Routine Chapter Description

geome-try properties of a space curve.

curvprpsp 2 Function using spline interpolation to

compute differential properties of a space curve.

derivatives of a cubic spline.

of several surfaces.

frus-tum.

surfmany 2 Function to plot several functions

to-gether without distortion.

rgdbodmo 2 Program illustrating 3D rigid body

ro-tation and translation.

rota-tion.

membran 3 Program illustrating static deßection of

a membrane.

value problem for a circular disk.

of a square using rational functions.

rational function interpolation.

func-tion using coefÞcients from funcfunc-tion

raterp.

dy-namics equation using eigenvector methods.

or-der matrix differential equation having

a harmonic forcing function.

null and eig to compute rectangular

membrane frequencies.

continued on next page

Trang 13

LIST OF MATLAB ROUTINES WITH DESCRIPTIONS 609

in-trinsic MATLAB matrix multiplication and slow Fortran style using loops.

interpo-lation allowing Þnite jump ities.

area bounded by a curve deÞned by spline interpolation.

interpo-lation coefÞcients used by function

spterp.

and integrate a cubic spline having general end conditions.

spterp.

splineq 4 Function to interpolate, integrate, and

differentiate using the intrinsic

func-tion spline.

used by splineg to handle general end

conditions.

MAT-LAB using a spline.

formulas.

formulas for derivatives of arbitrary der.

inte-grate an exact function or one deÞned

by spline interpolation.

integration of arbitrary order, and turn the base points and weight factors.

of gcquad and quadl for several test

functions.

continued on next page

Trang 14

Routine Chapter Description

coordinates and inertial properties

of general areas bounded by spline curves.

prop-erties of general areas.

prop-erties of partial volumes of revolution bounded by spline curves.

prop-erties of partial volumes of revolution.

rotasurf 5 Function to plot a partial surface of

rev-olution.

computation to evaluate geometrical properties of a rope shaped solid.

ropedraw 5 Function to draw a twisted rope shaped

surface.

to obtain geometrical properties.

prop-erties of a solid speciÞed by general surface coordinates.

prop-erties and a surface plot of an arbitrary polyhedron.

polhedron 5 Function for geometrical properties of

a polyhedron.

a polygon.

evaluate integrals having square root type singularities at the integration end points.

quadqsqrt 5 Function applying gcquad to integrals

having square root type singularities.

having square root type singularities.

continued on next page

Trang 15

LIST OF MATLAB ROUTINES WITH DESCRIPTIONS 611

evaluate a triple integral with variable integration limits.

order Bessel functions using the FFT.

earthquake data.

fouapprox 6 Function for Fourier series

approxima-tion of a general funcapproxima-tion.

se-ries expansions of general functions.

fousum 6 Function to sum a Fourier series and

in-clude coefÞcient smoothing.

analysis of a swinging cable.

re-sponse of a second order matrix ential equation with general initial con- ditions.

differ-strdynrk 7 Function using ode45 to solve a second

order matrix differential equation.

and fourth order integrators which use Þxed stepsize.

second order Þxed stepsize integrator.

a fourth order Þxed stepsize integrator.

Runge-Kutta integrators.

calculation of an inverted pendulum.

spinning top.

nonlin-ear dynamic response for a multi-link cable of rigid links.

continued on next page

Trang 16

Routine Chapter Description

re-sponse of a cable.

dy-namics of an elastic cable shaken at both ends.

the Laplace equation in a rectangle having general boundary conditions.

func-tion and gradient components in a angular region.

rect-stringft 9 Program for Fourier series solution and

animated response for a string with given initial displacement.

sub-jected to a moving concentrated load.

rectangular or circular membrane jected to an oscillating concentrated force.

rectangular membrane.

memcirwv 9 Function for dynamic response of a

cir-cular membrane.

besjroot 9 Function to compute a table of integer

order Bessel function roots.

response.

a simply supported beam subjected to

an oscillating end moment.

beamanim 9 Function to animate the motion of a

vi-brating beam.

pilevibs 9 Program illustrating the response of a

pile embedded in an oscillating elastic foundation.

having sinusoidally varying end perature.

tem-continued on next page

Trang 17

LIST OF MATLAB ROUTINES WITH DESCRIPTIONS 613

con-duction in a circular cylinder.

tempstdy 9 Function for the steady-state

tempera-ture in a circular cylinder with general boundary conditions.

Fourier-Bessel series.

besjtabl 9 Function giving a table of integer order

Bessel function roots.

in a beam of rectangular cross section.

a second order differential equation computed using Þnite difference meth- ods and using collocation with spline interpolation.

prnstres 10 Function to compute principal stresses

and principal directions for a ric second order stress tensor.

anima-tion of the natural vibraanima-tion modes of a general pin connected truss.

drawtruss 10 Function to draw the deßection modes

of a truss.

eigenvalue problem associated with

an elastic structure Þxed as selected points.

matrices of a pin connected truss.

a variable depth column with general end conditions.

natural frequencies computed by act, Þnite difference, and Þnite element methods.

ex-continued on next page

Trang 18

Routine Chapter Description

beam frequencies.

frequencies using Þnite difference methods.

frequencies using the Þnite element method.

animation of the mode shapes of an liptic membrane.

el-frqsimpl 10 Function to compute elliptic membrane

natural frequencies and mode shapes.

eigenrec 10 Function to solve a rectangular

eigen-value problem of the form: XA +

BX = λ(XC + DX).

plotmode 10 Function to plot the mode shapes of the

membrane.

slope, and deßection in a variable depth multi-support beam with general external loading conditions.

defor-mation quantities for distributed and concentrated loading on a beam.

beam loads.

trapsum 11 Trapezoidal rule function used to

inte-grate beam functions.

sqrtsurf 12 Function used to illustrate branch cut

discontinuities for an analytic function.

map-ping the exterior of a circle onto the terior of an ellipse.

ex-elipdplt 12 Program showing grid lines for

confor-mal mapping of a circular disk onto an elliptic disk.

continued on next page

Trang 19

LIST OF MATLAB ROUTINES WITH DESCRIPTIONS 615

elipdisk 12 Function mapping an elliptic disk onto

and straight lines under a linear tional transformation.

frac-ecentric 12 Function to determine a concentric

an-nulus which maps onto a given tric annulus.

eccen-swcsq10 12 Program illustrating both interior and

exterior maps regarding a circle and a square.

squarat 12 Rational function map taking the inside

of a circle onto the interior of a square

or the exterior of a square onto the terior of a square.

ex-swcsqmap 12 Function using truncated series

expan-sions in relation to circle to square maps.

in a circular disk for either Dirichlet or Neumann boundary conditions.

solve a mixed boundary value problem for a circular disk.

Cauchy integral.

elipcyl 12 Program illustrating inviscid ßuid ßow

about an elliptic cylinder in an inÞnite stream.

conformal mapping to compute sional stresses in a beam.

func-tions to compute stresses in a plate with

a circular hole.

continued on next page

Trang 20

Routine Chapter Description

platecrc 12 Function computing series coefÞcients

for complex stress functions pertaining

to a plate with a circular hole.

phi and psi.

func-tions to evaluate Cartesian stress ponents.

compo-nents from Cartesian to polar nates.

complex stress functions to compute stress in a plate with an elliptic hole.

to optimize a projectile trajectory.

search to Þt a nonlinear equation to vibration response data.

static equilibrium of a loaded cable.

descent curve (brachistochrone).

search to Þnd the closest points on two adjacent circular cylinders.

Þnd the closest points on two surfaces.

implements the Nelder and Mead rithm for multi-dimensional search.

Trang 21

5: % This function performs animation of a 2D curve

6: % x,y - arrays with columns containing curve positions

11: % titl- title for the graph

12: % tim - the time in seconds between successive plots

13:

14: if nargin<5, trace=0; else, trace=1; end;

15: if nargin<4, tim=.05; end

16: if nargin<3, trac=’’; end; [np,nt]=size(y);

17: if min(size(x))==1, j=ones(1,nt); x=x(:);

18: else, j=1:nt; end; ax=newplot;

19: if trace, XOR=’none’; else, XOR=’xor’; end

Trang 22

1: function [p,zplot]=aprop(xd,yd,kn)

2: %

3: % [p,zplot]=aprop(xd,yd,kn)

4: % ~~~~~~~~~~~~~~~~~~~~~~~~~

5: % This function determines geometrical properties

6: % of a general plane area bounded by a spline

7: % curve

8: %

9: % xd,yd - data points for spline interpolation

13: % kn - vector of indices of points where the

17: % p - the vector [a,xcg,ycg,axx,axy,ayy]

22: % zplot - complex vector of boundary points for

Trang 23

5: % This function computes an array of positive roots

6: % of the integer order Bessel functions besselj of

7: % the first kind for various orders A chosen number

8: % of roots is computed for each order

9: % norder - a vector of function orders for which

12: % nrts - the number of positive roots computed for

14: % rts - an array of roots having length(norder)

18: % tol - error tolerance for root computation

Trang 24

1: function range=cubrange(xyz,ovrsiz)

2: %

3: % range=cubrange(xyz,ovrsiz)

4: % ~~~~~~~~~~~~~~~~~~~~~~~~~~

5: % This function determines limits for a square

6: % or cube shaped region for plotting data values

7: % in the columns of array xyz to an undistorted

8: % scale

9: %

10: % xyz - a matrix of the form [x,y] or [x,y,z]

13: % ovrsiz - a scale factor for increasing the

16: %

17: % range - a vector used by function axis to set

28: if nargin==1, ovrsiz=1; end

29: pmin=min(xyz); pmax=max(xyz); pm=(pmin+pmax)/2;

Trang 25

3: % [z,zplot,zp]=curve2d(xd,yd,kn,t)

4: %~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

5: % This function generates a spline curve through

6: % given data points with corners (slope

dis-7: % continuities) allowed as selected points

8: % xd,yd - real data vectors of length nd

11: % kn - vectors of point indices, between one

14: % t - a vector of parameter values at which

22: % z - vector of points on the spline curve

24: % zplot - a complex vector of points suitable

26: % zp - first derivative of z with respect to

Trang 26

5: % This function solves the eigenvalue of the

6: % constrained eigenvalue problem

Trang 27

11: %

18: %

19: % evecs - matrix of eigenvectors orthogonal

24: % eigvals - a vector of the eigenvalues

5: % This function uses eigenfunction analysis to solve

6: % the matrix differential equation

7: % m*y’’(t)+c*y’(t)+k*y(t)=f1*cos(w*t)+f2*sin(w*t)

8: % with initial conditions of y(0)=y0, y’(0)=v0

9: % The solution is general unless 1) a zero or repeated

Trang 28

16: % f1,f2 - amplitude vectors for the sine and cosine

19: % tlim - a vector containing the minimum and

22: % nt - the number of times at which the solution

25: % y0,v0 - initial position and velocity vectors

26: %

30: % lam - the complex natural frequencies arranged

40: % Determine eigenvalues and eigenvectors for

41: % the homogeneous solution

42: A=[zeros(n,n), eye(n,n); -m\[k, c]];

43: [U,lam]=eig(A); [lam,j]=sort(diag(lam)); U=U(:,j);

44:

45: % Check for zero or repeated eigenvalues and

46: % for undamped resonance

47: wmin=abs(lam(1)); tol=wmin/1e6;

48: [dif,J]=min(abs(lam-i*w)); lj=num2str(lam(J));

49: if wmin==0, disp(’ ’)

50: disp(’The homogeneous equation has a zero’)

51: disp(’eigenvalue which is not allowed.’)

52: disp(’Execution is terminated’), disp(’ ’)

53: t=nan; y=nan; return

elseif any(abs(diff(lam))<tol)

Trang 29

59: disp(’The system is undamped and the forcing’)

60: disp([’function resonates with ’,

81: waterfall(t,(1:n),y’), xlabel(’time axis’)

82: ylabel(’mass index’), zlabel(’Displacements’)

83: title([’DISPLACEMENT HISTORY FOR A ’,

5: % This function approximates the k’th derivative

6: % of a function using function values at n

7: % interpolation points Let f(x) be a general

8: % function having its k’th derivative denoted

Trang 30

15: % error which decreases like h^m and

16: % TruncationError=(h^m)*(e(1)*F(x,n)+

17: % e(2)*F(x,n+1)*h+e(3)*F(x,n+2)*h^2+O(h^3))

18: %

19: % a - a vector of length n defining the

22: % k - order of derivative evaluated at x

23: % c - the weighting coeffients in the

26: % e - error component vector in the above

28: % m - order of truncation order in the

30: % crat - a matrix of integers such that c is

32:

33: a=a(:); n=length(a); m=n-k; mat=ones(n,n+4);

34: for j=2:n+4; mat(:,j)=a/(j-1).*mat(:,j-1); end

9: % This function integrates a general function using

10: % a composite Gauss formula of arbitrary order The

11: % integral value is returned along with base points

Trang 31

16: % making nquad function evaluations Results are

17: % exact for polynomials of degree up to 2*nquad-1

18: % ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

26: % xlow,xhigh - integration limits

30: % varargin - variable length parameter used to

42: % gives value = 1.935685556078172e+040 which is

43: % accurate within an error of 1.9e-13 percent

44: %

45: % User m functions called: the function name passed

47:

48:

% -49:

50: if isempty(nquad), nquad=10; end

51: if isempty(mparts), mparts=1; end

52:

53: % Compute base points and weight factors

54: % for the single interval [-1,1] (Ref:

55: % ’Methods of Numerical Integration’ by

% P Davis and P Rabinowitz, page 93)

Trang 32

63: % to apply for a composite interval

6: % This function views a surface from the top

7: % to show the coordinate lines of the surface

8: % It is useful for illustrating how coordinate

9: % lines distort in a conformal transformation

10: % Calling gridview with no arguments depicts the

11: % mapping of a polar coordinate grid map under

12: % a transformation of the form

13: % z=R*(zeta+m/zeta)

14: %

17: % xlabl,ylabl - labels for x and y axes

19: %

20: % User m functions called: cubrange

21:

Trang 33

33: a=2; b=1; R=(a+b)/2; m=(a-b)/(a+b);

34: z=R*(zeta+m./zeta); x=real(z); y=imag(z);

35: titl=[’Circular Annulus Mapped onto an ’,

43: plot(x,y,’-k’); xlabel(xlabl); ylabel(ylabl);

44: title(titl); axis(’equal’); axis(range);

45: grid on; figure(gcf);

52: xlabel(xlabl); ylabel(ylabl); title(titl);

53: axis(’equal’); axis(range); grid on;

Ngày đăng: 08/08/2014, 11:21

Nguồn tham khảo

Tài liệu tham khảo Loại Chi tiết
[1] M. Abramowitz and I.A. Stegun. Handbook of Mathematical Functions with Formulas, Graphs, and Mathematical Tables. National Bureau of Standards, Applied Math. Series #55. Dover Publications, 1965 Sách, tạp chí
Tiêu đề: Handbook of Mathematical Functions with"Formulas, Graphs, and Mathematical Tables
[2] J. H. Ahlberg, E. N. Nilson, and J. L. Walsh. The Theory of Splines and Their Applications. Mathematics in Science and Engineering, Volume 38.Academic Press, 1967 Sách, tạp chí
Tiêu đề: The Theory of Splines and"Their Applications
[3] J. Albrecht, L. Collatz, W. Velte, and W. Wunderlich, editors. Numerical Treatment of Eigenvalue Problems, volume 4. Birkhauser Verlag, 1987 Sách, tạp chí
Tiêu đề: Numerical"Treatment of Eigenvalue Problems
[4] E. Anderson, Z. Bai, C. Bischof, J. Demmel, J. Dongarra, J. Du Croz, A. Greenbaum, S. Hammarling, A. McKenney, S. Ostrouchov, and D. Sorensen. LAPACK User’s Guide. SIAM, Philadelphia, 1992 Sách, tạp chí
Tiêu đề: LAPACK User’s Guide
Tác giả: E. Anderson, Z. Bai, C. Bischof, J. Demmel, J. Dongarra, J. Du Croz, A. Greenbaum, S. Hammarling, A. McKenney, S. Ostrouchov, D. Sorensen
Nhà XB: SIAM
Năm: 1992
[5] F. Arbabi and F. Li. Macroelements for variable-section beams. Computers&amp; Structures, 37(4):553–559, 1990 Sách, tạp chí
Tiêu đề: Computers"& Structures
[6] B. A. Barsky. Computer Graphics and Geometric Modeling Using Beta- splines. Computer Science Workbench. Springer-Verlag, 1988 Sách, tạp chí
Tiêu đề: Computer Graphics and Geometric Modeling Using Beta-"splines
[7] K. J. Bathe. Finite Element Procedures in Engineering Analysis. Prentice- Hall, 1982 Sách, tạp chí
Tiêu đề: Finite Element Procedures in Engineering Analysis
[8] E. Becker, G. Carey, and J. Oden. Finite Elements, An Introduction. Prentice- Hall, 1981 Sách, tạp chí
Tiêu đề: Finite Elements, An Introduction
[9] F. Beer and R. Johnston, Jr. Mechanics of Materials. McGraw-Hill, second edition, 1992 Sách, tạp chí
Tiêu đề: Mechanics of Materials
Tác giả: F. Beer, R. Johnston, Jr
Nhà XB: McGraw-Hill
Năm: 1992
[10] K. S. Betts. Math packages multiply. CIME Mechanical Engineering, pages 32–38, August 1990 Sách, tạp chí
Tiêu đề: CIME Mechanical Engineering
[11] K.E. Brenan, S.L. Campbell, and L.R. Petzold. Numerical Solution of Initial- Value Problems in Differential-Algebraic Equations. Elsevier Science Pub- lishers, 1989 Sách, tạp chí
Tiêu đề: Numerical Solution of Initial-"Value Problems in Differential-Algebraic Equations
[15] B. Carnahan, H.A. Luther, and J. O. Wilkes. Applied Numerical Methods.John Wiley &amp; Sons, 1964 Sách, tạp chí
Tiêu đề: Applied Numerical Methods
Tác giả: B. Carnahan, H.A. Luther, J. O. Wilkes
Nhà XB: John Wiley & Sons
Năm: 1964
[16] F. E. Cellier and C. M. Rimvall. Matrix environments for continuous system modeling and simulation. Simulation, 52(4):141–149, 1989 Sách, tạp chí
Tiêu đề: Simulation
[17] B. Char, K. Geddes, G. Gonnet, and S. Watt. MAPLE User’s Guide, chapter First Leaves: A Tutorial Introduction to MAPLE. Watcom Publications Ltd., Waterloo, Ontario, 1985 Sách, tạp chí
Tiêu đề: MAPLE User’s Guide
Tác giả: B. Char, K. Geddes, G. Gonnet, S. Watt
Nhà XB: Watcom Publications Ltd.
Năm: 1985
[18] R. V. Churchhill, J. W. Brown, and R. F. Verhey. Complex Variables and Applications. McGraw-Hill, 1974 Sách, tạp chí
Tiêu đề: Complex Variables and"Applications
[19] Column Research Committee of Japan. Handbook of Structural Stability.Corona Publishing Company, Tokyo, 1971 Sách, tạp chí
Tiêu đề: Handbook of Structural Stability
[20] S. D. Conte and C. de Boor. Elementary Numerical Analysis: An Algorithmic Approach. McGraw-Hill, third edition, 1980 Sách, tạp chí
Tiêu đề: Elementary Numerical Analysis: An Algorithmic"Approach
[21] J. W. Cooley and J. W. Tukey. An algorithm for the machine calculation of complex fourier series. Math. Comp., 19:297–301, 1965 Sách, tạp chí
Tiêu đề: Math. Comp
[22] R. Courant and D. Hilbert. Methods of Mathematical Physics. Interscience Publishers, 1953 Sách, tạp chí
Tiêu đề: Methods of Mathematical Physics
[23] R. R. Craig Jr. Structural Dynamics. John Wiley &amp; Sons, 1988 Sách, tạp chí
Tiêu đề: Structural Dynamics
Tác giả: R. R. Craig Jr
Nhà XB: John Wiley & Sons
Năm: 1988

TỪ KHÓA LIÊN QUAN