TAILIEUCHUNG - Computational Statistics Handbook with MATLAB phần 10

Chúng tôi không bao gồm các khía cạnh đối tượng theo định hướng MATLAB ở đây. Vì vậy, chúng ta quan tâm chủ yếu là với các dữ liệu là điểm nổi (loại kép) hoặc chuỗi (kiểu char). Các yếu tố trong các mảng sẽ có hai loại dữ liệu này. | TABLE List of Element-by-Element Operators in Matlab Operator Usage . Multiply element-by-element. . Divide element-by-element. .A Raise elements to powers. Data Constructs in Matlab Basic Data Constructs We do not cover the object-oriented aspects of MATLAB here. Thus we are concerned mostly with data that are floating point type double or strings type char . The elements in the arrays will be of these two data types. The fundamental data element in MATLAB is an array. Arrays can be The 0 X 0 empty array created using . A 1 X 1 scalar array. A row vector which is a 1 X n array. A column vector which is an n X 1 array. A matrix with two dimensions say m X n or n X n . A multi-dimensional array say m X . X n . Arrays must always be dimensionally conformal and all elements must be of the same data type. In other words a 2 X 3 matrix must have 3 elements . numbers on each of its 2 rows. Table gives examples of how to access elements of arrays. Building Arrays In most cases the statistician or engineer will be using outside data in an analysis so the data would be imported into MATLAB using load or some other method described previously. Sometimes we need to type in simple arrays for testing code or entering parameters etc. Here we cover some of the ways to build small arrays. Note that this can also be used to concatenate arrays. 2002 by Chapman Hall CRC Commas or spaces concatenate elements which can be arrays as columns. Thus we get a row vector from the following temp 1 4 5 or we can concatenate two column vectors a and b into one matrix as follows temp a b The semi-colon tells MATLAB to concatenate elements as rows. So we would get a column vector from this command temp 1 4 5 We note that when concatenating array elements the sizes must be conformal. The ideas presented here also apply to cell arrays discussed below. Before we continue with cell arrays we cover some of the other useful functions in MATLAB for building arrays. These are summarized .

TỪ KHÓA LIÊN QUAN
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.