SlideShare a Scribd company logo
Primjena
računara
Matlab primjeri
Ekstrakcija elemenata matrice
• Svaki elemenat matrice se indeksira prema tome
  kojoj vrsti odnosno koloni pripada. Pristup
  elementu matrice u matlabu se vrši navođenjem
  vrste i kolone kojoj pripada.
  >> J = [1:4; 5:8; 9:12; 20 0 5 4]
  J=
     1 2 3 4
     5 6 7 8
     9 10 11 12
    20 0 5 4
  >> J(2,3)
  ans =

     7
Promjena elemenata matrice
 • Popuniti matricu 3x3              sa brojevima
   1,2,3, ..., 8,9 i promjeniti elemenat na presjeku
   treće vrste i treće kolone u 0
    • » A=[1 2 3;4 5 6; 7 8 9]
           A=
              1 2 3
              4 5 6
              7 8 9
    • » A(3,3)=0
           A=
              1 2 3
              4 5 6
              7 8 0
Pronalaženje indeksa
elemenata
• Naredba find se može korisiti za pronalazak
  indeksa elemenata matrice po nekom uslovu.
    >> A=[1 2 3;4 5 6; 7 8 9]
         A=

            1   2   3
            4   5   6
            7   8   9
     >> [i , j]=find(A>5)
Određivanje dimenzija matrice
• Ako nam dimenzije matrice, odnosno vektora nisu
  poznate, MATLAB nudi naredbe size i length koje
  nam daju informaciju o dimenzijama matrice.

  >> A=[1 2 3 4;5 6 7 8]
  A=
     1 2 3 4
     5 6 7 8

  >> s=size(A)
  s=
     2 4
Određivanje dimenzija matrice
(nastavak)
• Naredba length kao rezultat vraća broj kolona ili
  broj vrsta u zavisnosti od toga da li matrica ima
  veći broj vrsta ili kolona.
   >> length(A)
   ans =
       4
Jedinična matrica
• Jedinična matrica je naziv za kvadratnu matricu
  kojoj su elementi na glavnoj dijagonali jedinice, a
  ostali nule. Ova se matrica još naziva matricom
  identiteta, jer množenjem s drugim matricama
  daje upravo njih kao rezultat množenja tj. ne
  mijenja ih. Za definisanje jedinične matrice
  koristimo funkciju eye.
   >> eye(3)
   ans =

     1   0     0
     0   1     0
     0   0     1
Jedinična matrica (Zadatak)
• Definisati matricu M 4x4 sa elementima
  1,2,3,...,15,16 i jediničnu matricu I 4x4. Dokazati da
  se množenjem matrice M sa matricom I dobija ista
  ta matrica.
Magični kvadrati
• Neka matrica predstavlja magični kvadrat ako ima isti
  zbir svih elemanata u svim vrstama i kolonama. Za
  definisanje magičnih matrica koristimo funkciju
  magic(n) gdje je n dimenzija magične matrice, tj.
    >> B = magic(3)
         B=

            8   1    6
            3   5    7
            4   9    2
Magični kvadrati (zadatak)
• Koristeći      funkcije    sumiranja(sum)       i
  transponovanja(‘) dokazati da matrica definisana
  funkcijom magic zaista predstavlja magični
  kvadrat.
• Napomena: Kada se primjeni na matricu funkcija
  sum daje vektor koji predstavlja zbir elemenata
  svake kolone. Transponovanje matrice vrši
  zamjenu vrsta i kolona.

More Related Content

Featured

2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot
Marius Sescu
 
Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTEverything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPT
Expeed Software
 
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage Engineerings
Pixeldarts
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
ThinkNow
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
marketingartwork
 
Skeleton Culture Code
Skeleton Culture CodeSkeleton Culture Code
Skeleton Culture Code
Skeleton Technologies
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
Neil Kimberley
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
contently
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
Albert Qian
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
Kurio // The Social Media Age(ncy)
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
Search Engine Journal
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
SpeakerHub
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
Tessa Mero
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Lily Ray
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
Rajiv Jayarajah, MAppComm, ACC
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
Christy Abraham Joy
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
Vit Horky
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
MindGenius
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
RachelPearson36
 

Featured (20)

2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot
 
Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTEverything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPT
 
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage Engineerings
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
 
Skeleton Culture Code
Skeleton Culture CodeSkeleton Culture Code
Skeleton Culture Code
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
 

Examples

  • 2. Ekstrakcija elemenata matrice • Svaki elemenat matrice se indeksira prema tome kojoj vrsti odnosno koloni pripada. Pristup elementu matrice u matlabu se vrši navođenjem vrste i kolone kojoj pripada. >> J = [1:4; 5:8; 9:12; 20 0 5 4] J= 1 2 3 4 5 6 7 8 9 10 11 12 20 0 5 4 >> J(2,3) ans = 7
  • 3. Promjena elemenata matrice • Popuniti matricu 3x3 sa brojevima 1,2,3, ..., 8,9 i promjeniti elemenat na presjeku treće vrste i treće kolone u 0 • » A=[1 2 3;4 5 6; 7 8 9] A= 1 2 3 4 5 6 7 8 9 • » A(3,3)=0 A= 1 2 3 4 5 6 7 8 0
  • 4. Pronalaženje indeksa elemenata • Naredba find se može korisiti za pronalazak indeksa elemenata matrice po nekom uslovu. >> A=[1 2 3;4 5 6; 7 8 9] A= 1 2 3 4 5 6 7 8 9 >> [i , j]=find(A>5)
  • 5. Određivanje dimenzija matrice • Ako nam dimenzije matrice, odnosno vektora nisu poznate, MATLAB nudi naredbe size i length koje nam daju informaciju o dimenzijama matrice. >> A=[1 2 3 4;5 6 7 8] A= 1 2 3 4 5 6 7 8 >> s=size(A) s= 2 4
  • 6. Određivanje dimenzija matrice (nastavak) • Naredba length kao rezultat vraća broj kolona ili broj vrsta u zavisnosti od toga da li matrica ima veći broj vrsta ili kolona. >> length(A) ans = 4
  • 7. Jedinična matrica • Jedinična matrica je naziv za kvadratnu matricu kojoj su elementi na glavnoj dijagonali jedinice, a ostali nule. Ova se matrica još naziva matricom identiteta, jer množenjem s drugim matricama daje upravo njih kao rezultat množenja tj. ne mijenja ih. Za definisanje jedinične matrice koristimo funkciju eye. >> eye(3) ans = 1 0 0 0 1 0 0 0 1
  • 8. Jedinična matrica (Zadatak) • Definisati matricu M 4x4 sa elementima 1,2,3,...,15,16 i jediničnu matricu I 4x4. Dokazati da se množenjem matrice M sa matricom I dobija ista ta matrica.
  • 9. Magični kvadrati • Neka matrica predstavlja magični kvadrat ako ima isti zbir svih elemanata u svim vrstama i kolonama. Za definisanje magičnih matrica koristimo funkciju magic(n) gdje je n dimenzija magične matrice, tj. >> B = magic(3) B= 8 1 6 3 5 7 4 9 2
  • 10. Magični kvadrati (zadatak) • Koristeći funkcije sumiranja(sum) i transponovanja(‘) dokazati da matrica definisana funkcijom magic zaista predstavlja magični kvadrat. • Napomena: Kada se primjeni na matricu funkcija sum daje vektor koji predstavlja zbir elemenata svake kolone. Transponovanje matrice vrši zamjenu vrsta i kolona.