SlideShare a Scribd company logo
1 of 6
MATLAB
Developed by
Pranoti R. Doke
Date:
1
Chapter 5
(Useful Matrices Generators )
Useful Matrices Generators :
2
Zeros a matrix filled with zeros
ones a matrix filled with ones
rand a matrix with uniformly distributed random elements
randn a matrix with normally distributed random elements
eye identity matrix
>> a = zeros(2,3)
a =0 0 0
0 0 0
>> b = ones(2,2)/2
b =
0.5000 0.5000
0.5000 0.5000
>> u = rand(1,5)
u =
0.9218 0.7382 0.1763 0.4057 0.9355
1/7 …
3
>> n = randn(5,5)
n =
-0.4326 1.1909 -0.1867 0.1139 0.2944
-1.6656 1.1892 0.7258 1.0668 -1.3362
0.1253 -0.0376 -0.5883 0.0593 0.7143
0.2877 0.3273 2.1832 -0.0956 1.6236
-1.1465 0.1746 -0.1364 -0.8323 -0.6918
>> eye(3)
ans
1 0 0
0 1 0
0 0 1
2/7 …
4
>> a = [1 2 3 ; 4 5 6 ; 7 8 9]
a =1 2 3
4 5 6
7 8 9
>> a(3 , 2)
ans = 8
>> a(2 , :)
ans = 4 5 6
>> a(:,3)
ans = 3
6
9
3/7 …
5
(ref.Basics of Matlab and Beyond)
>> a = [1 2 3 ; 4 5 6 ; 7 8 9]
a =
1 2 3
4 5 6
7 8 9
>> a(: , : , 2) = a*2
a(: , : , 1) =
1 2 3
4 5 6
7 8 9
a(: , : , 2) =
2 4 6
8 10 12
14 16 18
>> a (: , : ,3) = eye(3)
a(: , : , 3) =
1 0 0
0 1 0
0 0 1
Examples to solve :
6
Q). Create 3*3 ones matrix
Q). Create 4*4 zeros matrix
Q). Calculate rand and randn
Q). Show 4*4 identity matrix using MATLAB command

More Related Content

More from Pranoti Doke

Unit 3 cnd physical layer_switching_pranoti doke
Unit 3  cnd physical layer_switching_pranoti dokeUnit 3  cnd physical layer_switching_pranoti doke
Unit 3 cnd physical layer_switching_pranoti dokePranoti Doke
 
Unit 3 CND physical layer_switching_pranoti doke
Unit 3  CND physical layer_switching_pranoti dokeUnit 3  CND physical layer_switching_pranoti doke
Unit 3 CND physical layer_switching_pranoti dokePranoti Doke
 
Unit 3 CND_Physical Layer_Multiplexing_Pranoti Doke
Unit 3  CND_Physical Layer_Multiplexing_Pranoti DokeUnit 3  CND_Physical Layer_Multiplexing_Pranoti Doke
Unit 3 CND_Physical Layer_Multiplexing_Pranoti DokePranoti Doke
 
Unit 3_CND Physical Layer_MODEMS_Pranoti Doke
Unit 3_CND Physical Layer_MODEMS_Pranoti DokeUnit 3_CND Physical Layer_MODEMS_Pranoti Doke
Unit 3_CND Physical Layer_MODEMS_Pranoti DokePranoti Doke
 
Unit 3 _CND_22634_ physical layer_transmission medium_pranoti doke
Unit 3 _CND_22634_ physical layer_transmission medium_pranoti dokeUnit 3 _CND_22634_ physical layer_transmission medium_pranoti doke
Unit 3 _CND_22634_ physical layer_transmission medium_pranoti dokePranoti Doke
 
Programmable Logic Controller by Pranoti R. Doke
Programmable Logic Controller by Pranoti R. DokeProgrammable Logic Controller by Pranoti R. Doke
Programmable Logic Controller by Pranoti R. DokePranoti Doke
 
C programming Ms. Pranoti Doke
C programming Ms. Pranoti DokeC programming Ms. Pranoti Doke
C programming Ms. Pranoti DokePranoti Doke
 
C programming_MSBTE_Diploma_Pranoti Doke
C programming_MSBTE_Diploma_Pranoti DokeC programming_MSBTE_Diploma_Pranoti Doke
C programming_MSBTE_Diploma_Pranoti DokePranoti Doke
 
Unit 2 cnd_22634_pranoti doke
Unit 2 cnd_22634_pranoti dokeUnit 2 cnd_22634_pranoti doke
Unit 2 cnd_22634_pranoti dokePranoti Doke
 
CND_22634_UNIT1_MSBTE_Computer network and Data Communication
CND_22634_UNIT1_MSBTE_Computer network and Data CommunicationCND_22634_UNIT1_MSBTE_Computer network and Data Communication
CND_22634_UNIT1_MSBTE_Computer network and Data CommunicationPranoti Doke
 
Chapter 10 Programming in Matlab
Chapter 10 Programming in MatlabChapter 10 Programming in Matlab
Chapter 10 Programming in MatlabPranoti Doke
 
Chapter 9 Display Commands in MATLAB
Chapter 9 Display Commands in MATLABChapter 9 Display Commands in MATLAB
Chapter 9 Display Commands in MATLABPranoti Doke
 
Chapter 8 Data Types in MATLAB
Chapter 8 Data Types in MATLABChapter 8 Data Types in MATLAB
Chapter 8 Data Types in MATLABPranoti Doke
 
Chapter 7 Formats in MATLAB
Chapter 7 Formats in MATLABChapter 7 Formats in MATLAB
Chapter 7 Formats in MATLABPranoti Doke
 
Chapter 6 Matrices in MATLAB
Chapter 6 Matrices in MATLABChapter 6 Matrices in MATLAB
Chapter 6 Matrices in MATLABPranoti Doke
 
Chapter 4 Keyboard in MATLAB Shortcuts
Chapter 4 Keyboard in MATLAB ShortcutsChapter 4 Keyboard in MATLAB Shortcuts
Chapter 4 Keyboard in MATLAB ShortcutsPranoti Doke
 
Chapter 3 Commands at MATLAB Command Window
Chapter 3 Commands at MATLAB Command WindowChapter 3 Commands at MATLAB Command Window
Chapter 3 Commands at MATLAB Command WindowPranoti Doke
 
Chapter 2 Basics of MATLAB
Chapter 2 Basics of MATLABChapter 2 Basics of MATLAB
Chapter 2 Basics of MATLABPranoti Doke
 
Chapter 1 matlab demo
Chapter 1 matlab demoChapter 1 matlab demo
Chapter 1 matlab demoPranoti Doke
 

More from Pranoti Doke (19)

Unit 3 cnd physical layer_switching_pranoti doke
Unit 3  cnd physical layer_switching_pranoti dokeUnit 3  cnd physical layer_switching_pranoti doke
Unit 3 cnd physical layer_switching_pranoti doke
 
Unit 3 CND physical layer_switching_pranoti doke
Unit 3  CND physical layer_switching_pranoti dokeUnit 3  CND physical layer_switching_pranoti doke
Unit 3 CND physical layer_switching_pranoti doke
 
Unit 3 CND_Physical Layer_Multiplexing_Pranoti Doke
Unit 3  CND_Physical Layer_Multiplexing_Pranoti DokeUnit 3  CND_Physical Layer_Multiplexing_Pranoti Doke
Unit 3 CND_Physical Layer_Multiplexing_Pranoti Doke
 
Unit 3_CND Physical Layer_MODEMS_Pranoti Doke
Unit 3_CND Physical Layer_MODEMS_Pranoti DokeUnit 3_CND Physical Layer_MODEMS_Pranoti Doke
Unit 3_CND Physical Layer_MODEMS_Pranoti Doke
 
Unit 3 _CND_22634_ physical layer_transmission medium_pranoti doke
Unit 3 _CND_22634_ physical layer_transmission medium_pranoti dokeUnit 3 _CND_22634_ physical layer_transmission medium_pranoti doke
Unit 3 _CND_22634_ physical layer_transmission medium_pranoti doke
 
Programmable Logic Controller by Pranoti R. Doke
Programmable Logic Controller by Pranoti R. DokeProgrammable Logic Controller by Pranoti R. Doke
Programmable Logic Controller by Pranoti R. Doke
 
C programming Ms. Pranoti Doke
C programming Ms. Pranoti DokeC programming Ms. Pranoti Doke
C programming Ms. Pranoti Doke
 
C programming_MSBTE_Diploma_Pranoti Doke
C programming_MSBTE_Diploma_Pranoti DokeC programming_MSBTE_Diploma_Pranoti Doke
C programming_MSBTE_Diploma_Pranoti Doke
 
Unit 2 cnd_22634_pranoti doke
Unit 2 cnd_22634_pranoti dokeUnit 2 cnd_22634_pranoti doke
Unit 2 cnd_22634_pranoti doke
 
CND_22634_UNIT1_MSBTE_Computer network and Data Communication
CND_22634_UNIT1_MSBTE_Computer network and Data CommunicationCND_22634_UNIT1_MSBTE_Computer network and Data Communication
CND_22634_UNIT1_MSBTE_Computer network and Data Communication
 
Chapter 10 Programming in Matlab
Chapter 10 Programming in MatlabChapter 10 Programming in Matlab
Chapter 10 Programming in Matlab
 
Chapter 9 Display Commands in MATLAB
Chapter 9 Display Commands in MATLABChapter 9 Display Commands in MATLAB
Chapter 9 Display Commands in MATLAB
 
Chapter 8 Data Types in MATLAB
Chapter 8 Data Types in MATLABChapter 8 Data Types in MATLAB
Chapter 8 Data Types in MATLAB
 
Chapter 7 Formats in MATLAB
Chapter 7 Formats in MATLABChapter 7 Formats in MATLAB
Chapter 7 Formats in MATLAB
 
Chapter 6 Matrices in MATLAB
Chapter 6 Matrices in MATLABChapter 6 Matrices in MATLAB
Chapter 6 Matrices in MATLAB
 
Chapter 4 Keyboard in MATLAB Shortcuts
Chapter 4 Keyboard in MATLAB ShortcutsChapter 4 Keyboard in MATLAB Shortcuts
Chapter 4 Keyboard in MATLAB Shortcuts
 
Chapter 3 Commands at MATLAB Command Window
Chapter 3 Commands at MATLAB Command WindowChapter 3 Commands at MATLAB Command Window
Chapter 3 Commands at MATLAB Command Window
 
Chapter 2 Basics of MATLAB
Chapter 2 Basics of MATLABChapter 2 Basics of MATLAB
Chapter 2 Basics of MATLAB
 
Chapter 1 matlab demo
Chapter 1 matlab demoChapter 1 matlab demo
Chapter 1 matlab demo
 

Recently uploaded

GreenSEO April 2024: Join the Green Web Revolution
GreenSEO April 2024: Join the Green Web RevolutionGreenSEO April 2024: Join the Green Web Revolution
GreenSEO April 2024: Join the Green Web RevolutionWilliam Barnes
 
marketing strategy of tanishq word PPROJECT.pdf
marketing strategy of tanishq word PPROJECT.pdfmarketing strategy of tanishq word PPROJECT.pdf
marketing strategy of tanishq word PPROJECT.pdfarsathsahil
 
VIP 7001035870 Find & Meet Hyderabad Call Girls Film Nagar high-profile Call ...
VIP 7001035870 Find & Meet Hyderabad Call Girls Film Nagar high-profile Call ...VIP 7001035870 Find & Meet Hyderabad Call Girls Film Nagar high-profile Call ...
VIP 7001035870 Find & Meet Hyderabad Call Girls Film Nagar high-profile Call ...aditipandeya
 
Mastering SEO in the Evolving AI-driven World
Mastering SEO in the Evolving AI-driven WorldMastering SEO in the Evolving AI-driven World
Mastering SEO in the Evolving AI-driven WorldScalenut
 
DGR_Digital Advertising Strategies for a Cookieless World_Presentation.pdf
DGR_Digital Advertising Strategies for a Cookieless World_Presentation.pdfDGR_Digital Advertising Strategies for a Cookieless World_Presentation.pdf
DGR_Digital Advertising Strategies for a Cookieless World_Presentation.pdfDemandbase
 
VIP Call Girls In Green Park 9654467111 Escorts Service
VIP Call Girls In Green Park 9654467111 Escorts ServiceVIP Call Girls In Green Park 9654467111 Escorts Service
VIP Call Girls In Green Park 9654467111 Escorts ServiceSapana Sha
 
Do More with Less: Navigating Customer Acquisition Challenges for Today's Ent...
Do More with Less: Navigating Customer Acquisition Challenges for Today's Ent...Do More with Less: Navigating Customer Acquisition Challenges for Today's Ent...
Do More with Less: Navigating Customer Acquisition Challenges for Today's Ent...Search Engine Journal
 
Uncover Insightful User Journey Secrets Using GA4 Reports
Uncover Insightful User Journey Secrets Using GA4 ReportsUncover Insightful User Journey Secrets Using GA4 Reports
Uncover Insightful User Journey Secrets Using GA4 ReportsVWO
 
Unraveling the Mystery of Roanoke Colony: What Really Happened?
Unraveling the Mystery of Roanoke Colony: What Really Happened?Unraveling the Mystery of Roanoke Colony: What Really Happened?
Unraveling the Mystery of Roanoke Colony: What Really Happened?elizabethella096
 
The Pitfalls of Keyword Stuffing in SEO Copywriting
The Pitfalls of Keyword Stuffing in SEO CopywritingThe Pitfalls of Keyword Stuffing in SEO Copywriting
The Pitfalls of Keyword Stuffing in SEO CopywritingJuan Pineda
 
SORA AI: Will It Be the Future of Video Creation?
SORA AI: Will It Be the Future of Video Creation?SORA AI: Will It Be the Future of Video Creation?
SORA AI: Will It Be the Future of Video Creation?Searchable Design
 
April 2024 - VBOUT Partners Meeting Group
April 2024 - VBOUT Partners Meeting GroupApril 2024 - VBOUT Partners Meeting Group
April 2024 - VBOUT Partners Meeting GroupVbout.com
 
TOP DUBAI AGENCY OFFERS EXPERT DIGITAL MARKETING SERVICES.pdf
TOP DUBAI AGENCY OFFERS EXPERT DIGITAL MARKETING SERVICES.pdfTOP DUBAI AGENCY OFFERS EXPERT DIGITAL MARKETING SERVICES.pdf
TOP DUBAI AGENCY OFFERS EXPERT DIGITAL MARKETING SERVICES.pdfasiyahanif9977
 
Brighton SEO April 2024 - The Good, the Bad & the Ugly of SEO Success
Brighton SEO April 2024 - The Good, the Bad & the Ugly of SEO SuccessBrighton SEO April 2024 - The Good, the Bad & the Ugly of SEO Success
Brighton SEO April 2024 - The Good, the Bad & the Ugly of SEO SuccessVarn
 
Red bull marketing presentation pptxxxxx
Red bull marketing presentation pptxxxxxRed bull marketing presentation pptxxxxx
Red bull marketing presentation pptxxxxx216310017
 
pptx.marketing strategy of tanishq. pptx
pptx.marketing strategy of tanishq. pptxpptx.marketing strategy of tanishq. pptx
pptx.marketing strategy of tanishq. pptxarsathsahil
 
How To Utilize Calculated Properties in your HubSpot Setup
How To Utilize Calculated Properties in your HubSpot SetupHow To Utilize Calculated Properties in your HubSpot Setup
How To Utilize Calculated Properties in your HubSpot Setupssuser4571da
 
Moving beyond multi-touch attribution - DigiMarCon CanWest 2024
Moving beyond multi-touch attribution - DigiMarCon CanWest 2024Moving beyond multi-touch attribution - DigiMarCon CanWest 2024
Moving beyond multi-touch attribution - DigiMarCon CanWest 2024Richard Ingilby
 

Recently uploaded (20)

GreenSEO April 2024: Join the Green Web Revolution
GreenSEO April 2024: Join the Green Web RevolutionGreenSEO April 2024: Join the Green Web Revolution
GreenSEO April 2024: Join the Green Web Revolution
 
marketing strategy of tanishq word PPROJECT.pdf
marketing strategy of tanishq word PPROJECT.pdfmarketing strategy of tanishq word PPROJECT.pdf
marketing strategy of tanishq word PPROJECT.pdf
 
VIP 7001035870 Find & Meet Hyderabad Call Girls Film Nagar high-profile Call ...
VIP 7001035870 Find & Meet Hyderabad Call Girls Film Nagar high-profile Call ...VIP 7001035870 Find & Meet Hyderabad Call Girls Film Nagar high-profile Call ...
VIP 7001035870 Find & Meet Hyderabad Call Girls Film Nagar high-profile Call ...
 
Mastering SEO in the Evolving AI-driven World
Mastering SEO in the Evolving AI-driven WorldMastering SEO in the Evolving AI-driven World
Mastering SEO in the Evolving AI-driven World
 
DGR_Digital Advertising Strategies for a Cookieless World_Presentation.pdf
DGR_Digital Advertising Strategies for a Cookieless World_Presentation.pdfDGR_Digital Advertising Strategies for a Cookieless World_Presentation.pdf
DGR_Digital Advertising Strategies for a Cookieless World_Presentation.pdf
 
How to Create a Social Media Plan Like a Pro - Jordan Scheltgen
How to Create a Social Media Plan Like a Pro - Jordan ScheltgenHow to Create a Social Media Plan Like a Pro - Jordan Scheltgen
How to Create a Social Media Plan Like a Pro - Jordan Scheltgen
 
VIP Call Girls In Green Park 9654467111 Escorts Service
VIP Call Girls In Green Park 9654467111 Escorts ServiceVIP Call Girls In Green Park 9654467111 Escorts Service
VIP Call Girls In Green Park 9654467111 Escorts Service
 
Do More with Less: Navigating Customer Acquisition Challenges for Today's Ent...
Do More with Less: Navigating Customer Acquisition Challenges for Today's Ent...Do More with Less: Navigating Customer Acquisition Challenges for Today's Ent...
Do More with Less: Navigating Customer Acquisition Challenges for Today's Ent...
 
Uncover Insightful User Journey Secrets Using GA4 Reports
Uncover Insightful User Journey Secrets Using GA4 ReportsUncover Insightful User Journey Secrets Using GA4 Reports
Uncover Insightful User Journey Secrets Using GA4 Reports
 
Unraveling the Mystery of Roanoke Colony: What Really Happened?
Unraveling the Mystery of Roanoke Colony: What Really Happened?Unraveling the Mystery of Roanoke Colony: What Really Happened?
Unraveling the Mystery of Roanoke Colony: What Really Happened?
 
The Pitfalls of Keyword Stuffing in SEO Copywriting
The Pitfalls of Keyword Stuffing in SEO CopywritingThe Pitfalls of Keyword Stuffing in SEO Copywriting
The Pitfalls of Keyword Stuffing in SEO Copywriting
 
SORA AI: Will It Be the Future of Video Creation?
SORA AI: Will It Be the Future of Video Creation?SORA AI: Will It Be the Future of Video Creation?
SORA AI: Will It Be the Future of Video Creation?
 
April 2024 - VBOUT Partners Meeting Group
April 2024 - VBOUT Partners Meeting GroupApril 2024 - VBOUT Partners Meeting Group
April 2024 - VBOUT Partners Meeting Group
 
TOP DUBAI AGENCY OFFERS EXPERT DIGITAL MARKETING SERVICES.pdf
TOP DUBAI AGENCY OFFERS EXPERT DIGITAL MARKETING SERVICES.pdfTOP DUBAI AGENCY OFFERS EXPERT DIGITAL MARKETING SERVICES.pdf
TOP DUBAI AGENCY OFFERS EXPERT DIGITAL MARKETING SERVICES.pdf
 
Brighton SEO April 2024 - The Good, the Bad & the Ugly of SEO Success
Brighton SEO April 2024 - The Good, the Bad & the Ugly of SEO SuccessBrighton SEO April 2024 - The Good, the Bad & the Ugly of SEO Success
Brighton SEO April 2024 - The Good, the Bad & the Ugly of SEO Success
 
Red bull marketing presentation pptxxxxx
Red bull marketing presentation pptxxxxxRed bull marketing presentation pptxxxxx
Red bull marketing presentation pptxxxxx
 
pptx.marketing strategy of tanishq. pptx
pptx.marketing strategy of tanishq. pptxpptx.marketing strategy of tanishq. pptx
pptx.marketing strategy of tanishq. pptx
 
The Future of Brands on LinkedIn - Alison Kaltman
The Future of Brands on LinkedIn - Alison KaltmanThe Future of Brands on LinkedIn - Alison Kaltman
The Future of Brands on LinkedIn - Alison Kaltman
 
How To Utilize Calculated Properties in your HubSpot Setup
How To Utilize Calculated Properties in your HubSpot SetupHow To Utilize Calculated Properties in your HubSpot Setup
How To Utilize Calculated Properties in your HubSpot Setup
 
Moving beyond multi-touch attribution - DigiMarCon CanWest 2024
Moving beyond multi-touch attribution - DigiMarCon CanWest 2024Moving beyond multi-touch attribution - DigiMarCon CanWest 2024
Moving beyond multi-touch attribution - DigiMarCon CanWest 2024
 

Chapter 5 Useful Matrices Generators

  • 1. MATLAB Developed by Pranoti R. Doke Date: 1 Chapter 5 (Useful Matrices Generators )
  • 2. Useful Matrices Generators : 2 Zeros a matrix filled with zeros ones a matrix filled with ones rand a matrix with uniformly distributed random elements randn a matrix with normally distributed random elements eye identity matrix >> a = zeros(2,3) a =0 0 0 0 0 0 >> b = ones(2,2)/2 b = 0.5000 0.5000 0.5000 0.5000 >> u = rand(1,5) u = 0.9218 0.7382 0.1763 0.4057 0.9355
  • 3. 1/7 … 3 >> n = randn(5,5) n = -0.4326 1.1909 -0.1867 0.1139 0.2944 -1.6656 1.1892 0.7258 1.0668 -1.3362 0.1253 -0.0376 -0.5883 0.0593 0.7143 0.2877 0.3273 2.1832 -0.0956 1.6236 -1.1465 0.1746 -0.1364 -0.8323 -0.6918 >> eye(3) ans 1 0 0 0 1 0 0 0 1
  • 4. 2/7 … 4 >> a = [1 2 3 ; 4 5 6 ; 7 8 9] a =1 2 3 4 5 6 7 8 9 >> a(3 , 2) ans = 8 >> a(2 , :) ans = 4 5 6 >> a(:,3) ans = 3 6 9
  • 5. 3/7 … 5 (ref.Basics of Matlab and Beyond) >> a = [1 2 3 ; 4 5 6 ; 7 8 9] a = 1 2 3 4 5 6 7 8 9 >> a(: , : , 2) = a*2 a(: , : , 1) = 1 2 3 4 5 6 7 8 9 a(: , : , 2) = 2 4 6 8 10 12 14 16 18 >> a (: , : ,3) = eye(3) a(: , : , 3) = 1 0 0 0 1 0 0 0 1
  • 6. Examples to solve : 6 Q). Create 3*3 ones matrix Q). Create 4*4 zeros matrix Q). Calculate rand and randn Q). Show 4*4 identity matrix using MATLAB command