TAILIEUCHUNG - Engineering Matlab Problem Solving phần 4

(start:increment:end) where start is the starting index, increment is the amount to add to each successive index, and end is the ending index, where start, increment, and end must be integers. The increment can be negative, but negative indices are not allowed to be generated. If the increment is to be 1, a shortened form of the notation may be used: (start:end) • 1:5 means “start with 1 and count up to 5.” x(1:5) ans = 0 • 7:end means “start with 7 and count up to the end of the vector.” x(7:end) ans. | start increment end where start is the starting index increment is the amount to add to each successive index and end is the ending index where start increment and end must be integers. The increment can be negative but negative indices are not allowed to be generated. If the increment is to be 1 a shortened form of the notation may be used start end 1 5 means start with 1 and count up to 5. x 1 5 ans 0 7 end means start with 7 and count up to the end of the vector. x 7 end ans 3 -1 1 means start with 3 and count down to 1. y 3 -1 1 ans 0 Thus a negative index can be used but the indices generated must all be positive integers. 2 2 7 means start with 2 count up by 2 and stop at 7. x 2 2 7 ans 3 1 means start with 3 count up by 1 and stop at 1. This clearly doesn t make sense so Matlab generates the error message x 3 1 ans Empty matrix 1-by-0 A vector can be used to access elements of an vector in a desired order. To access elements 8 2 9 and 1 of y in order y 8 2 9 1 ans 0 83 Vector Creation Alternatives Explicit lists are often cumbersome ways to enter vector values. Alternatives Combining A vector can also be defined using another vector that has already been defined. For example B S B S Changing Values can be changed by referencing a specific address. For example S 2 S S changes the second value in the vector S from to . Extending Additional values can be added using a reference to a specific address. For example the following command S 4 S S extends the length of vector S from 3 to 4. Applying the following command S 7 S S 0 0 extends the length of S to 7 and the values of S 5 and S 6 are automatically set to zero because no values were given for them. Colon notation A generalized version of the colon .

TỪ KHÓA LIÊN QUAN
TAILIEUCHUNG - Chia sẻ tài liệu không giới hạn
Địa chỉ : 444 Hoang Hoa Tham, Hanoi, Viet Nam
Website : tailieuchung.com
Email : tailieuchung20@gmail.com
Tailieuchung.com là thư viện tài liệu trực tuyến, nơi chia sẽ trao đổi hàng triệu tài liệu như luận văn đồ án, sách, giáo trình, đề thi.
Chúng tôi không chịu trách nhiệm liên quan đến các vấn đề bản quyền nội dung tài liệu được thành viên tự nguyện đăng tải lên, nếu phát hiện thấy tài liệu xấu hoặc tài liệu có bản quyền xin hãy email cho chúng tôi.
Đã 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.