Mavzu: Matrisalarning asosiy xarakteristikalarini xisoblash Masalaning qo’yilishi


Download 1.03 Mb.
Sana13.05.2023
Hajmi1.03 Mb.
#1455800
Bog'liq
1-amaliy Mashinali


MUHAMMAD AL-XORAZMIY NOMIDAGI TOSHKENT AXBOROT TEXNOLOGIYALARI UNIVERSITETI

Mashinali o`qitishga kirish” fanidan



AMALIY ISH – 1

Bajardi: Turkmanov Sh.
Tekshirdi: Kubayev S.

SAMARQAND-2023


Mavzu: Matrisalarning asosiy xarakteristikalarini xisoblash
Masalaning qo’yilishi: Matlabda matritsalarni chapdan o’ngga burishda fliplr komandasidan foydalanish:
A=[-1 0 1; 0 -1 0; 1 -1 1]

1-rasm. A matritsa yaratdik

2-rasm. fliplr(A) buyrug’i orqali matrit chapdan o’ngga burishda sonlarni ekranga chiqardik
Endi shu komandani qo’lda bajarib chiqamiz:
>> for i=1:3; for j=1:3; C(i,j)=A(3-i+1,j);end; end; C



3-rasm. Bu matrisani qo’lda bajardik va
>> for i=1:3; for j=1:3; C(i,j)=A(3-i+1,j);end; end; C shu kodni ekranga chiqard
4-rasm. Buda esa yuqoridan pastga burishda flipud(A) komandasidan foydalandik.
Endi shu amalni algoritmi bilan tanishib chiqamiz:
>> for i=1:3; for j=1:3; C(j,i)=A(j,3-i+1); end; end; C



5-rasm. Bu rasmda A matrisani algoritm ko’rinishi

6-rasm. Bu rasmda matritsani soat strelkasiga qarshi 90 0 ga burish uchun ishlatiladigan rot90(A) komandasidan foydalandik.
Endi shu amalning bajarilish tartibi ya’ni algoritmi haqida ko’rib chiqamiz:
>> for i=1:3; for j=1:3; C(i,j)=A(j,3-i+1); end; end; C

7-rasm. Matrisani 90 ga burgandagi algortim ko’rinishida ekranga chiqardik.

Dasturning kodi:

A=[-1 0 1; 0 -1 0; 1 -1 1]

A =


-1 0 1
0 -1 0
1 -1 1

fliplr(A)

ans =

1 0 -1
0 -1 0


1 -1 1

for i=1:3; for j=1:3; C(i,j)=A(3-i+1,j);end; end; C

C =

1 -1 1
0 -1 0


-1 0 1

flipud(A)

ans =

1 -1 1
0 -1 0


-1 0 1

for i=1:3; for j=1:3; C(j,i)=A(j,3-i+1); end; end; C

C =

1 0 -1
0 -1 0


1 -1 1

rot90
Not enough input arguments.

Error in rot90 (line 22)
if ~isscalar(k)

rot (90)
Unrecognized function or variable 'rot'.

Did you mean:
dot (90)
Not enough input arguments.

Error in dot (line 21)


if isinteger(a) || isinteger(b)

rot90(A)

ans =


1 0 1
0 -1 -1
-1 0 1

for i=1:3; for j=1:3; C(i,j)=A(j,3-i+1); end; end; C



C =

1 0 1
0 -1 -1


-1 0 1
Download 1.03 Mb.

Do'stlaringiz bilan baham:




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©fayllar.org 2024
ma'muriyatiga murojaat qiling