+3-мавзу-mo' da Матлаб(57-110). doc
Download 362.77 Kb. Pdf ko'rish
|
tril(A) - berilgan matritsaning diagonaildan yuqori qismini elementlarini 0
bilan almashtirishni amalga oshiradi. Misol. Berilgan matritsaning diagonaildan yuqori qismini elementlarini 0 bilan almashtirish: >> A=[-1 2 4 0 3; -2 1 0 3 4; -2 -1 0 -2 1; -2 3 -1 -1 1; 1 1 1 -1 -1] A = -1 2 4 0 3 -2 1 0 3 4 -2 -1 0 -2 1 -2 3 -1 -1 1 1 1 1 -1 -1 >> tril(A) ans = -1 0 0 0 0 -2 1 0 0 0 -2 -1 0 0 0 -2 3 -1 -1 0 1 1 1 -1 -1 Endi shu buyruqni o’zimiz m-faylga yozib yangi yuqori degan buyruq hosil qilamiz (3.11-rasm). 3.11-rasm. >> B=yuqori(A) x = 5 B = -1 0 0 0 0 81 -2 1 0 0 0 -2 -1 0 0 0 -2 3 -1 -1 0 1 1 1 -1 -1 triu(A) - buyrug’i esa matritsaning diagonalidan pastki qismini nollarga aylantirishni amalga oshiradi. Misol. Berilgan matritsaning diagonaildan pastki qismini elementlarini 0 bilan almashtirish: >> A=[-1 2 4 0 3; -2 1 0 3 4; -2 -1 0 -2 1; -2 3 -1 -1 1; 1 1 1 -1 -1] A = -1 2 4 0 3 -2 1 0 3 4 -2 -1 0 -2 1 -2 3 -1 -1 1 1 1 1 -1 -1 >> triu(A) ans = -1 2 4 0 3 0 1 0 3 4 0 0 0 -2 1 0 0 0 -1 1 0 0 0 0 -1 Ushbu triu protsedurasini algoritmini o’zimiz tuzib m-faylga yozib chiqamiz va quyidagi natijalarga erishamiz (3.12-rasm). 3.12-rasm. >> B=pastki(A) x = 5 A = -1 2 4 0 3 82 0 1 0 3 4 0 0 0 -2 1 0 0 0 -1 1 0 0 0 0 -1 RESHAPE - matrisa o’lchamini o’zgartishni amalga oshirdi. >> A=[-1 0 2 0; 0 1 2 -1; -1 -2 -3 2] A = -1 0 2 0 0 1 2 -1 -1 -2 -3 2 >> reshape(A,2,6) % matritsa elementlarining soniga qarab ixtiyoriy o`lchamdagi matritsani hosil qiladi. ans = -1 -1 1 2 -3 -1 0 0 -2 2 0 2 Download 362.77 Kb. Do'stlaringiz bilan baham: |
Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©fayllar.org 2024
ma'muriyatiga murojaat qiling
ma'muriyatiga murojaat qiling