• 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
  • >> B=pastki(A) x = 5 A = -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
  • -1 -2 -3 2 >> reshape(A,2,6)
  • Y = Zeros(n) Y = Zeros (m, n)
  • Mustaqil ish fan: Amaliy dasturiy paketlar




    Download 232,03 Kb.
    bet5/8
    Sana27.05.2024
    Hajmi232,03 Kb.
    #255039
    1   2   3   4   5   6   7   8
    Bog'liq
    Matlab tizimida matritsalar ustida arifmetik amallar bajarish

    1 1 1 -1 -1
    >> tril (A)
    ans =
    0 0 0 0 0
    1 0 0 0 0
    -2 -1 0 0 0
    -2 3 -1 -1 0
    Endi shu buyruqni o’zimiz m-faylga yozib yangi yuqori degan buyruq hosil qilamiz.
    >> B=yuqori(A)
    x = 5
    B =
    -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
    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 .
    >> B=pastki(A)
    x = 5
    A =
    -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
    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


    3 Matritsalarni maxsus ko’rinishda hosil qilish
    ZEROS - masssiv elementlarini nollardan iborat qilib tuzadi.
    Sintaksisi:
    Y = Zeros(n)
    Y = Zeros (m, n)

    Download 232,03 Kb.
    1   2   3   4   5   6   7   8




    Download 232,03 Kb.

    Bosh sahifa
    Aloqalar

        Bosh sahifa



    Mustaqil ish fan: Amaliy dasturiy paketlar

    Download 232,03 Kb.