Mathcad va matlab muhitida ishlash
Download 208.42 Kb.
|
MatLAB Matn
inv(M) – M matritsaga teskari matritsani qaytaradi.
Misol: >> M=[2 1 -5 1;1 -3 0 -6;0 2 -1 2;1 4 -7 6] M = 2 1 -5 1 1 -3 0 -6 0 2 -1 2 1 4 -7 6 >> P=inv(M) P = 1.3333 -0.6667 0.3333 -1.0000 -0.0741 0.2593 1.1481 -0.1111 0.3704 -0.2963 0.2593 -0.4444 0.2593 -0.4074 -0.5185 -0.1111 >> M*P % M*P=E ekanligini tekshirish ans = 1.0000 -0.0000 -0.0000 0.0000 0 1.0000 0.0000 0.0000 0.0000 -0.0000 1.0000 -0.0000 0.0000 -0.0000 -0.0000 1.0000 magic(n) – funksiyasi nn o’lchamli sirli matritsani beradi, yani barcha ustun elementlari yig’indisi, barcha satr elementlari yig’indisi va hatto diagonal bo’yicha elementlar yig’indisi bir xil songa teng bo’ladi. Masalan: >> M=magic(4) M = 16 2 3 13 5 11 10 8 9 7 6 12 4 14 15 1 >> sum(M') ans = 34 34 34 34 >> M=magic(10) M = 92 99 1 8 15 67 74 51 58 40 98 80 7 14 16 73 55 57 64 41 4 81 88 20 22 54 56 63 70 47 85 87 19 21 3 60 62 69 71 28 86 93 25 2 9 61 68 75 52 34 17 24 76 83 90 42 49 26 33 65 23 5 82 89 91 48 30 32 39 66 79 6 13 95 97 29 31 38 45 72 10 12 94 96 78 35 37 44 46 53 11 18 100 77 84 36 43 50 27 59 >> sum(M') ans = 505 505 505 505 505 505 505 505 505 505 >> M=magic(3) M = 8 1 6 3 5 7 4 9 2 >> sum(M') ans = 15 15 15 linsolve(A, b) - A·x=b ko’rinishdagi chiziqli tenglamalar sistemasi yechimini, linsolve(A, b, options) formatida tenglama yechish metodini berish imkonini chaqiradi. >> A=[2 -1 1;3 2 -5;1 3 -2]; >> b=[0;1;4]; >> x=linsolve(A,b) % chiziqli tenglamalar sistemasi yechish x = [ 13/28] [ 47/28] [ 3/4] >> A*x %yechimni to’g’riligini tekshirish ans = [ 0] [ 1] [ 4] Download 208.42 Kb. Do'stlaringiz bilan baham: |
Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©fayllar.org 2024
ma'muriyatiga murojaat qiling
ma'muriyatiga murojaat qiling