Elementary mathematical and computational tools for electrical engineers using Matlab - Chapter 8

Matrices Thiết lập ma trận Định nghĩa ma trận A là một tập hợp các con số được sắp xếp trong một dimen hai sional (2-D) mảng cấu trúc. Mỗi phần tử của ma trận, gọi nó là Mi, j, chiếm hàng thứ i và cột thứ j. | 8 Matrices Setting up Matrices DEFINITION A matrix is a collection of numbers arranged in a two-dimensional 2-D array structure. Each element of the matrix call it Mi j occupies the ith row and jth column. M11 M12 M13 M. 1 1n M m21 M M22 M23 M2n M Mm1 Mm2 Mm3 Mmn _ We say that M is an m n matrix which means that it has m rows and n columns. If m n we call the matrix square. If m 1 the matrix is a row vector and if n 1 the matrix is a column vector. Creating Matrices in MATLAB Entering the Elements In this method the different elements of the matrix are keyed in for example M 1 3 5 7 11 13 17 19 23 29 31 37 41 47 53 gives M 1 3 5 7 11 13 17 19 23 29 31 37 41 47 53 2001 by CRC Press LLC To find the size of the matrix . the number of rows and columns enter size M gives ans 3 5 To view a particular element for example the 2 4 element enter M 2 4 gives ans 23 To view a particular row such as the 3rd row enter M 3 gives ans 31 37 41 47 53 To view a particular column such as the 4th column enter M 4 gives ans 7 23 47 If we wanted to construct a submatrix of the original matrix for example one that includes the block from the 2nd to 3rd row included and from the 2nd column to the 4th column included enter M 2 3 2 4 2001 by CRC Press LLC gives ans 17 19 23 37 41 47 Retrieving Special Matrices from the MATLAB Library MATLAB has some commonly used specialized matrices in its library that can be called as needed. For example The matrix of size m n with all elements being zero is M zeros m n For example M zeros 3 4 gives M 0 0 0 0 0 0 0 0 0 0 0 0 The matrix of size m n with all elements equal to 1 is N ones m n For example N ones 4 3 produces N 111 111 111 111 The matrix of size n n with only the diagonal elements equal to one otherwise zero is P eye n n For example 2001 by CRC Press .

Không thể tạo bản xem trước, hãy bấm tải xuống
TÀI LIỆU MỚI ĐĂNG
Đã 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.