## Microsoft word - 6_operaciebi_matricebze.doc

MATLAB saSualebiT skalaruli namravli SeiZleba gamovTvaloT Semdegnairad: gavixsenoT, rom A. * B Secavs am veqtorebis Sesabamis wevrTa namravls. Tu orive striqoni veqtori, an orive sveti veqtoria, A.*B agreTve veqtoria, aviRebT am veqtoris elementTa jams da miviRebT skalarul namravls. Tu A striqoni veqtoria, xolo B sveti veqtori, maSin skalaruli namravli ori gziT SegviZlia gamovTvaloT: MATLAB–s agreTve gaaCnia funqcia veqtorebis skalaruli namravlis
gamosaTvlelad – dot. dot(A,B) igive Sedegs mogvcems rasac - sum(A.*B).
amitom A da B urTieTSebrunebuli matricebia, anu A = B-1 da B = A-1.
Sebrunebuli matricis gamoTvla mosawyeni da damRleli procesia. sabednirod
MATLAB Seicavs funqcias inv, romelic gamoiTvlis matricis Sebrunebuls. (ar
moviyvanT algoriTms matricis Sebrunebulis gamosaTvlelad, igi ganxiluli iqneba
wrfiv algebrasTan dakavSirebul TavSi. amgvarad, Tu mivcemT brZanebas inv(A),
Sedegad miviRebT B matricas da piriqiT.
matricis Sebrunebulis gamoTvla gvWirdeba mravali sainJinro amocanis
MATLA-is saSualebiT SeqmeniT Semdegi matricebi da SeasruleT miTiTebuli moqmedebani: 2. DB 3. BC’ 4. (CB)D’ 5. B-1 6. BB-1 7. B-1B 8. AC’ 9. (AC’)-1 10. (AC’)-1(AC’) 11. IB 12. BI 4.1.6 determinanti matricis determinanti skalaria, romelic matricis elementebis saSualebiT gamoiTvleba. determinants farTo gamoyeneba aqvs mravali problemis amoxsnisas, maT Soris matricis Sebrunebulis gamoTvlis da wrfiv gantolebaTa sistemis amoxsnisas. 22 zomis matricis determinanti Semdegnairad gamoiTvleba: 33 zomis matricis determinanti Semdegnairad gamoiTvleba: |A| = a1,1a2,2 a3,3+a2,1a2,3 a3,2+ a1,3a2,1 a3,2- a3,1a2,2 a1,3- a3,2a2,3 a1,1- a3,3a2,1 a1,2 |A| = 5 + 6 + 0 – 0 – 4 – (-3), anu 10
ufro rTulia procesi ufro meti elementebis Semcveli matricis determinantis
aRwera, radgan MATLAB saSualebiT SegviZlia gamoviTvaloT determinanti
funqciiT det, romlis argumentia kvadratuli matrica.

genur inJineriaSi did rols TamaSobs iseTi mowyobiloba, rogoricaa proteinis (cilis) sinTezatori. mas SeuZlia gansazRvros aminomJavaTa rigi, mimdevroba cilis jaWvisebur molekulaSi. aminomJavaTa rigi exmareba genetikosebs daadginon (gaaigivon) geni, romelsac Seicavs Seqmnili cila. fermentebis saSualebiT SesaZlebelia kavSiris darRveva mezobel genebs Soris, imisaTvis rom gamocalkevdes saWiro geni DNA (dezoqsiribonukleinis mJava)-dan. es geni Semdeg SehyavT sxva organizmSi, rogorc baqteria, romelic Semdeg gamravldeba axal garemoSi. arsebobs mxolod 20 sxvadasxva aminomJava. cilis molekulea Seicavs asoboT aminomJavas, romlebic dakavSirebuli arian erTmaneTTan garkveuli rigiT. mocemul amocanaSi davuSvaT rom dadgenilia proteinis molekulaSi aminomJavaTa momdevroba da unda gamovTvaloT cilis molekuluri wona. cxrilSi mocemulia anbanis mixedviT dalagebuli aminomJavaTa mwkrivi, maTi mokle aRniSvna da molekuluri wona. am amocanis sawyisi monacemebia monacemTa faili protein.dat, romelic Seicavs aminomJavaTa raodenobas da tips cilis TiToeul molekulaSi. davuSvaT monacemTa faili Seiqmna cilis sintezatoris saSualebiT. failis monacemTa yoveli striqoni Seesabameba erT cilas da Seicavs 20 mTel ricxvs, romelic Seesabameba cxrilSi aminomJavas rigiT nomers. amrigad Semdegi striqoni: Seesabameba cilas aminomJavaTa mimdevrobiT – LysGluMetAspSerGlu. INPUT/OUTPUT aRwera
naxazze mocemuli INPUT/OUTPUT diagrama, romelic gviCvenebs, rom sawyisi monacemebi warmodgenilia failis saxiT, romelic Seicavs monacemebs cilis molekuluri Semcvelobis Sesaxeb - romeli tipis aminomJavas Seicavs mocemuli cila da ra raodenobiT. davuSvaT gvaqvs cilis molekula LysGluMetAspSerGlu. maTi Sesabamisi molekuluri wonebia : aqedan gamomdinare, cilis molekuluri wona iqneba 825. monacemTa failSi am cilas Seesabameba striqoni: cilis molekuluri wona rom miviRoT calkeuli aminomJavas raodenoba unda gavamravloT Sesabamis molekulur wonaze da miRebuli Sedegebi SevkriboT. aseTi namravlebis jami SegviZlia ganvixiloT rogorc cilis veqtoris da wonaTa veqtoris skalaruli namravli. Tu gvinda gamovTvaloT molekuluri wona cilaTa jgufisaTvis, Sedegi SegviZlia miviRoT matricebis gadamravlebiT Semdegnairad: 0 0 0 1 0 2 0 0 0 0 0 1 1 0 0 1 0 0 0 0 131  825  0 1 0 0 0 1 1 0 0 3 0 0 0 0 0 0 0 1 0 0 131  MATLAB amoxsna
MATLAB saSualebiT es amocana Zalze martivad amoixsneba. informacia aminmJavebis Sesaxeb wakiTxuli iqneba monacemTa failidan da Seiqmneba matrica protein, ganisazRvreba sveti veqtori mw, romlis elementebic iqneba anbanis mixedviT dalagebul aminomJavaTa molekuluri wonebi. am ori matricis gadamravlebiT miviRebT axal matricas, romlis elementebic iqneba cilis molekuluri wonebi. Tthis program computes the molecular weights for a group of protein molekules. A data file contains the occurence and number of amino acids in each load protein.dat mw=[89 175 132 132 121 146 146 75 156 131 131 147 . 149 165 116 105 119 203 181 117];  [rows cols] = size(protein); for k=1:rows fprintf('protein %3.0f: molecular weight = %5.0f \n',k, weights(k)) end davuSvaT cilaTa jgufi, romlisTvisac viTvliT molekulur wonebs aseTia: GlyIleSerThrTrp AspHisProGln ThrTyrSerTrpLysMetHisMet AlaValLeuValMet LysGluMetAspSerGluLysGluGluGlu 0 0 0 0 0 0 0 1 0 1 0 0 0 0 0 1 1 1 0 0 0 0 0 1 0 0 1 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 1 2 0 0 1 1 1 1 0 1 0 0 0 0 0 0 0 0 0 1 0 1 0 0 0 0 0 0 2 0 0 0 1 0 4 0 1 0 0 0 2 1 0 0 1 0 0 0 0 MATLAB dagvibeWdavs molekulur wonebs cilebisaTvis: protein 1: molecular weight = 633 protein 2: molecular weight = 550 protein 3: molecular weight = 1209 protein 4: molecular weight = 603 protein 5: molecular weight = 1339 4.1.7 Semobruneba
SesaZlebelia matrica A SemovabrunoT 90 gradusiT saaTis isris sawinaaRmdego
mimarTulebiT brZanebiT - rot90. Tu gvaqvs:
Tu gavuSvebT brZanebas : B = rot90(A); miviRebT: am brZanebas SeiZleba meore argumentic hqondes, romelic gansazRvravs ramdenjer Semobrundes matrica 90 gradusiT. brZanebebi: matrica SegviZlia ‘gadavabrunoT’ marjvnidan marcxniv fliplr an zemodan qvemoT
A = [1 2; 4 8; -2 0]; B = fliplr(A); C = flipud(B); A   4 8 B  8 4  C   4 8 brZaneba reshape mocemul matricas Seucvlis formas – Tanafardobas striqonebis
da svetebis raodenobas Soris. funqciis argumentebi ise unda SeirCes, rom sawyis
da Sedegad miRebul matricebis elementTa raodenoba erTnairi iyos. am funqcias
gaaCnia sami argumenti. pirveli, Tavad matricaa, bolo ori ki gansazRvravs axali
matricis striqonebis da svetebis raodenobas. magaliTad ganvixiloT Semdegi
brZanebebi:
A = [2 5 6 –1; 3 –2 10 0]; B = reshape(A,4,2); C = reshape(A,8,1); matricis nawilis amoReba axali matricis saxiT funqciebi diag, triu, tril saSualebas gvaZlevs matricis elementebi amoviRoT. samive
brZanebaSi igulisxmeba matricis mTavari diagonali, Tu igi kvadratuli araa.
mTavari im diagonals ewodeba, romelic iwyeba zeda marcxena kuTxidan da
elementebis svetis da striqonis mimTiTebeli indeqsebi erTnairia – a1,1, a2,2 da a.S.
magaliTadAA matricis mTavari diagonalis elementebia 2, -2. B – 2, 10, xolo C –
2. funqcia diag(A) Seqmnis svet veqtors, romlis elementebic A matricis mTavari
diagonalis elementebs Seicavs.
SeiZleba am funqcias meore argumentic hqondes diag(A,k). im SemTxvevaSi Tu gvsurs
diagonalis rigi mivuTiToT. Tu k > 0, mTavari diagonalis zemoT k-ur diagonali
SeirCeva, Tu k <0, MmTavari diagonalis qvemoT k-uri diagonali iqneba SerCeuli.
Seqmnis kvadratul matricas, romlis mTavari diagonalc mocemuli veqtoris
elementebia, yvela sxva elementi ki 0-is tolia. magaliTad:

funqcia triu(A) Seqmnis matricas, romelic Seicavs A matricis mTavari diagonalis
da mis zemoT ganlagebul elementebs, danarCeni elementebi nulis tolia. am
funqcias SeiZleba meore argumentic hqondes. funqcia triu(A,k) mogvcems matricas,
romelic igive zomisa, rac A , Seicavs mis elementebs k-uri diagonals zemoT, an
qvemoT, sxva yvela elementi 0-is tolia. ganvixiloT MATLAB brZanebebi:
A = [1:2:7; 3:3:12; 4:-1:1; 1:4]; B = triu(A); C = triu(A,-1); D = triu(A,3); Tril funqcia msgavsia triu funqciisa, mxolod is Qqmnis qveda samkuTxa matricas. Tu
wina magaliTSi SevcvliT triu funqcias tril –iT, miviRebT:
gansazRvreT matricebi, romelic Seiqmneba Semdegi funqciebis moqmedebis Sedegad, Tu viciT, rom: 1. rot90(B) 2. rot90(A,3) 3. fliplr(A) 4. flipud(fliplr(B)) 5. reshape(A,4,3) 6. reshape(A,6,2) 7. reshape(A,2,6) 8. reshape(flipud(B),8,2) 9. triu(B) 10. triu(B,-1) 11. tril(A,2) 12. diag(rot90(B)) gamonasaxTa SeTavseba (image alignment)

cifruli gamonasaxi warmodgenilia matricis saxiT, romlis elementebic
sinaTlis intensivobas Seesabameba. aseTi matricis elementebs piqselebs anu
suraTis elementebs uwodeben. maRali garCevis gamonasaxi Seicavs elementTa did
raodenobas, dabali garCevis – mcire raodenobas. magaliTad maRali garCevis
gamonasaxi SesaZloa Seicavdes 1024 striqons da amdenive svets, ese igi
piqselebis saerTo raodenoba milionze meti iqneba. TiToeuli sidide aseT
matricaSi aris kodi, romelic sinaTlis intensivobas Seesabameba. kodi SeiZleba
Seicavdes informacias feris an Sav-TeTri gamonasaxis SemTxvevaSi nacrisfris
davuSvaT gamonasaxi warmodgenilia 6 striqoniani da 6 svetiani matricis saxiT.
aseve davuSvaT, rom matricis TiToeuli elementi 0 da 7 Sorisaa moTavsebuli,
davuSvaT gvaqvs erTidaigive obieqtis ori gamonasaxi eTidaigive garCeviT da ruxi feris tonalobaTa kodiT. aseve davuSvaT, rom ar viciT gamonasaxebs erTmaneTis mimarT rogori mdebareoba ukaviaT. imisaTvis, rom isini erTmaneTs SevuTavsoT, erTerTi maTgani ucvleld davtovoT, meore ki matriculi manipulaciebiT SevuTavsoT mas. isini SeTavsebulad CaTvleba, roca Sesabamisi elementebis mniSvnelobebi erTmaneTs daemTxveva. magaliTad davuSvaT A da B matricebi erTidaigive obieqtis gamonasaxebia: imisaTvis, rom B SevuTavsoT A, igi unda SemovabrunoT 270 gradusiT saaTis isris sawinaaRmdegod (an 90 gradusiT saaTis isris mimarTulebiT). anda gadavabrunoT B qvemodan zemoT da SemovabrunoT 90 gradusiT saaTis isris sawinaaRmdegod. SeamowmeT samive gza, raTa darwmundeT, rom gamonasaxebi amgvarad SeTavsdebian. imisaTvis, rom ganvsazRvroT SeuTavsda Tu ara ori gamonasaxi (image 1 da image 2) erTmaneTs, SegviZlia gamovTvaloT sxvaobebi Sesabamis elementebs Soris da miRebuli Sedegebi SevkriboT. amas mivaRwevT MATLAB brZanebiT:
sum funqcia orjer gavimeoreT imitom, rom yvela sxvaoba Segvekriba. pirveli sum
mogvcems veqtors, romlis elementebia Sesabamisi svetebis elementebis jami, xolo
meore sum Sekrebs am veqtoris elementebs. samwuxarod, SesaZloa es jami 0
gamovides. ganvixiloT ori gamonasaxis Sesabamisi matrica:
Tu gamoviTvliT am ori matricis Sesabamisi elementebs Soris sxvaobebis jams miviRebT 5 + (-5) = 0. Tumca cxadad Cans, rom isini arTidaigive gamonasaxebi namdvilad ar aris. 0 imitom miviReT, rom dadebiTma da uaryofiTma sxvaobebma gaabaTila erTmaneTi. Tu sxvaobebs kvadratSi aviyvanT, an maT absolutur sidides aviRebT da ise daviTvliT jams, es sidideebi erTmaneTs veRar gaabaTilebs. MATLAB brZanebiT miiReba ase gamoTvlili sxvaobaTa jami, romelsac vuwodebT manZilis zomas: distance = sum(sum(image1 – image2).^2)); SegviZlia daviTvaloT es manZilebi yvela SesaZlo SeTavsebis SemTxvevaSi. ori gamonasaxi CaiTvleba SeTavsebulad, Tu manZili 0 tolia. Tu gaviTvaliswinebT, rom erTidaimave obieqtis ori sxvadasxva gamonasaxis Sesabamis elementebs SeiZleba mcired gansxvavebuli mniSvnelobebi hqondes (gamowveuli instrumentuli cTomilebiT an sakomunikacio arxebSi xmauriT), SegviZlia gamovTvaloT manZilebi yvela SesaZlo SeTavsebisTvis da Semdeg avirCioT maT Soris umciresi. ganvsazRvroT ori gamonasaxis SeTavsebisaTvis ra saxis manipulaciebia saWiro. INPUT/OUTPUT aRwera
nax. 6.2 warmoadgens INPUT/OUTPUT diagramas, sadac naCvenebia, rom sawyis monacemebs viRebT ori failidan, Sedegi ki warmoadgens sidides: erTerTi gamonasaxis 90 gradusiT ramdenjer Sebruneba dagvWirda, rom igi meore gamonasaxs SeTavseboda. Tu SevabrunebT D mimdevrobiT 0, 90, 180, 270, miviRebT: axla Tu gamoviTvliT manZilebs (elementebs Siris sxvaobaTa kvadratebis jams) C matricasa da D –s am oTx versias Soris, miviRebT: 19, 7, 1 da 13 Sesabamisad. rogirc vxedavT minimaluri manZili = 1, rasac Seesabameba saaTis isris sawinaaRmdegod 180 gradusiT Semobruneba. MATLAB amoxsna

vuSvebT, rom ori gamonasaxi Cawerilia ASCII monacemTa failis saxiT. saWiroa 4
ciklis gamoTvla, rom miviRoT mobrunebis 4 sxvadasxva mniSvneloba. Semdeg
vsargeblobT min funqciiT, rom SevarCioT minimaluri manZili da misi Sesabamisi
mdebareoba manZilebis veqtorSi. ase ganvsazRvravT Tu ramdenjer SemovabruneT
This program determines the best alignment between for k=0:3 a=rot90(image2,k); distance(k+1)=sum(sum(image1-a).^2); end  [minval, minloc]=min(distance); fprintf('Image alignment best at %3.0f degrees \n',. (minloc-1)*90) fprintf('(counterclockwise) \n \n') SevniSvavT, rom es programa imuSavebs nebismieri garCevis gamonasaxebisaTvis. erTaderTi moTxovnaa, rom gamonasaxebis Sesabamis matricebs erTnairi zoma hqondeT. Tu am programas SevamowmebT zemoT ganxiluli A da B matricebisaTvis miviRebT: Image alignment best at 270 degrees (counterclockwise) am TavSi SevajameT matriculi gamoTvlebis da manipulaciebis operaciebi.
ganvsazRvreT matricis transponirebuli da Sebrunebuli. vnaxeT rogor
gamovTvaloT ori veqtoris skalaruli namravli da rogor gadavamravloT erTi
matrica meoreze. gavecaniT MATLAB funqciebs, romelTa saSualebiTac SegviZlia
SevcvaloT matricis forma da struqtura. funqciiT rot90 SegviZlia SemovabrunoT
matricis elementebi saaTis isris sawinarmdego momarTulebiT. reshape funqcia
saSualebas gvaZlevs SevqmnaT axali matrica elementebis igive raodenobiT. gavecaniT
funqciebs, romelTa saSualebiT SegviZlia matricidan amoviRoT elementebi da ase
SevqmnaT axali matrica an veqtori.