SlideShare a Scribd company logo
POLYTECHNIC UNGKU OMAR
                           ELECTRICAL ENGINEERING DEPARTMENT
Course         :      E5124 DATA COMMUNICATION (Lab work)
Experiment     :      Matlab 1 – Get Familiarize (Matrices and Plot)



The objective of this session is to learn:
       - How to launch the matlab software
       - Few simple calculations and formulation
       - Plot command and graphical output




Introduction

Matlab is a tool for doing numerical computations with matrices and vectors. It can also display information
graphically. The best way to learn what Matlab can do is to work through some examples at the computer. After
reading and familiarize with this exercise you will be able to solve construct own work.




Starting MATLAB


Launch MATLAB by double-clicking on the MATLAB icon on your Windows desktop. When you start MATLAB, a
special window called the MATLAB desktop appears. The desktop is a window that contains other windows. The
major tools within or accessible from the desktop are (refer Fig 1):
        - The Command Window
        - The Command History
        - The Workspace
        - The Current Directory
        - The Help Browser
        - The Start button




                                                                                                             1
Fig 1 : The graphical interface to the Matlab workspace



Table below shows arithmetic operators for calculation and equation in Matlab application.




As an example of a simple interactive calculation, just type the expression you want to evaluate. Let's start at the
very beginning. For example, let's suppose you want to calculate the expression, 1 + 2 x 3. You type it at the prompt
command (>>) as follows,

                                                                                                                   2
>> 1+2*3

                 ans =
                          7

You will have noticed that if you do not specify an output variable, MATLAB uses a default variable ans, short for
answer, to store the results of the current calculation. Note that the variable ans is created (or overwritten, if it is
already existed). To avoid this, you may assign a value to a variable or output argument name. For example,
                >> x = 1+2*3

                 x=
                          7

will result in x being given the value 1 + 2 x 3 = 7. This variable name can always be used to refer to the results of the
previous computations. Therefore, computing 4x will result in
                  >> 4*x

                 ans =
                          28.0000


Exercise
1.      Matrix

1.1     Insert the following expression and observe the result.

        >>aa=[l 3 4; 5 7 8; 2 3 5]
        Observation




        >> y=[10; 9; 8]
        Observation




                                                                                                                        3
1.2   Insert both expressions.

              >>aa=[l 3 4; 5 7 8; 2 3 5];
              >> y=[10; 9; 8];

      Now obtain result for following expression
             >>aay
      Observation




             >>inv(aa)*y
      Observation




             >> [inv(aa)*y aay]
      Observation




      Explain your observation for expression [inv(aa)*y aay]

      _____________________________________________________________________________________

      _____________________________________________________________________________________


2.    Matrix Loop

2.1   Insert following expression and obtain result


                                                                                              4
>> a = [ 0.8 0.1; 0.2 0.9 ]
      Observation




      >> x = [ 1; 0 ]
      Observation




2.2   Type below expression and state your observation
      >> a = [ 0.8 0.1; 0.2 0.9 ];
      >> x = [ 1; 0 ];
      >> for i = 1:20, x = a*x, end

      Observation




                                                         5
3.    Plot

      MATLAB has an excellent set of graphic tools. Plotting a given data set or the results of computation is
      possible with very few commands. You are highly encouraged to plot mathematical functions and results of
      analysis as often as possible. Trying to understand mathematical equations with graphics is an enjoyable and
      very e±cient way of learning mathematics. Being able to plot mathematical functions and data freely is the
      most important step, and this section is written to assist you to do just that.

3.1   Let say, your given few samples of variable which need to find out their performance rate. Now, insert following
      expression:-
              >> a=[1 2 3 4 6 4 3 4 5]

      Observation




             >> b=a+2
      Observation




3.2   Use plot command to plot your result.

             >> plot(b)
      Observation




             >> grid on
      Observation




                                                                                                                    6
3.3   Use label and title command to provide information at graph. Type this command step by step in order to
      observe result. Before you type command, display your Matlab window panel and graph window side by
      side in order to get better view.

              >> xlabel('Sequence of b')
              >> ylabel('b value')
              >> title(‘Graphical output for b sequence of number’)

      Observation




3.4   Bar command used to plot bar graph which able to show us the statistical result.

              >> bar(b)
              >> xlabel('Number of sample')
              >> ylabel('Weight of random samples in kg')

      Observation




                                                                                                           7
>> plot(b,'*')
>> axis([0 12 0 10])

        Observation




        What did you see from both graphs? Explain.

        ______________________________________________________________________________________

        ______________________________________________________________________________________


3.5     To make a graph of y = sin(t) on the interval t = 0 to t = 10, do the following steps:
                       >> t = 0:.3:10;
                       >> y = sin(t);
                       >> plot(t,y)
                       >> title('Sine wave ')
                       >> xlabel(‘Time, t')
                       >> ylabel('Amplitude')

        Observation




                                                                                                 8
3.6      Plotting multiple wave or result in single graph. Execute following command and make your observation.
         Insert title and label by yourself.

>> t=0:0.1:30;
>> y1=sin(t);
>> y2=cos(t);
>> plot(t,y1,'--',t,y2,'-r')
        Observation




>> t=0:0.1:30;
>> y1=sin(t).*t;
>> y2=cos(t).*t;
>> plot(t,y1,'--',t,y2,'-r')
        Observation




                                                                                                                  9
3.7   Subplot
      The subplot is used to put multiple plots on the same MATLAB figure window.
              subplot(pqr) - p & q represent matrixes, r locating position for plotted graph
      a) Write the following expression and obtain the result.

               >> x = 0 : 0.1 : 3 *pi;
               >> y = sin(x);
               >> z = cos(x);
               >> subplot(222)
               >> plot(x,y)
               >> title('Sine wave y')
               >> xlabel('time, x')
               >> ylabel('Amplitude, y')
               >> subplot(223)
               >> title('x and z')
               >> subplot(224)
               >> plot(x,y,'-',x,z,' -- ')
               >> title('x and [y z]')

      b) Once complete your subplot, insert label and title for each graph individually. Use example as given in
         above command.
         Observation




                                                                                                             10
c) Discrete sample graphical output.
          Type following command and make observation. State the differences between both results.

                >> p=0:0.05:5;
                >> q=sin(p.^2);
                >> plot(p,q);

       Observation




                >> p=0:0.05:5;
                >> q=sin(p.^2);
                >> stem(p,q);

       Observation




Reflection

_____________________________________________________________________________________________

_____________________________________________________________________________________________

_____________________________________________________________________________________________

_____________________________________________________________________________________________


                                                                                                     11

More Related Content

What's hot

Introduction to MATLAB
Introduction to MATLABIntroduction to MATLAB
Introduction to MATLAB
Damian T. Gordon
 
Chapter2
Chapter2Chapter2
Chapter2
Krishna Kumar
 
MATLAB for Technical Computing
MATLAB for Technical ComputingMATLAB for Technical Computing
MATLAB for Technical Computing
Naveed Rehman
 
Lec 9 05_sept [compatibility mode]
Lec 9 05_sept [compatibility mode]Lec 9 05_sept [compatibility mode]
Lec 9 05_sept [compatibility mode]Palak Sanghani
 
Introduction to matlab lecture 3 of 4
Introduction to matlab lecture 3 of 4Introduction to matlab lecture 3 of 4
Introduction to matlab lecture 3 of 4
Randa Elanwar
 
Matlab ch1 intro
Matlab ch1 introMatlab ch1 intro
Matlab ch1 intro
Ragu Nathan
 
Mechanical Engineering Homework Help
Mechanical Engineering Homework HelpMechanical Engineering Homework Help
Mechanical Engineering Homework Help
Matlab Assignment Experts
 
N-Queens Combinatorial Problem - Polyglot FP for fun and profit - Haskell and...
N-Queens Combinatorial Problem - Polyglot FP for fun and profit - Haskell and...N-Queens Combinatorial Problem - Polyglot FP for fun and profit - Haskell and...
N-Queens Combinatorial Problem - Polyglot FP for fun and profit - Haskell and...
Philip Schwarz
 
Tutorial 2
Tutorial     2Tutorial     2
Tutorial 2
Mohamed Yaser
 
Introduction to matlab lecture 2 of 4
Introduction to matlab lecture 2 of 4Introduction to matlab lecture 2 of 4
Introduction to matlab lecture 2 of 4
Randa Elanwar
 
Mmc manual
Mmc manualMmc manual
Mmc manual
Urvi Surat
 
matlab
matlabmatlab
matlab
Farhan Ahmed
 
Scala as a Declarative Language
Scala as a Declarative LanguageScala as a Declarative Language
Scala as a Declarative Language
vsssuresh
 
Array
ArrayArray
Array
Anil Dutt
 
Matlab practice
Matlab practiceMatlab practice
Matlab practice
ZunAib Ali
 

What's hot (20)

Introduction to MATLAB
Introduction to MATLABIntroduction to MATLAB
Introduction to MATLAB
 
Chapter2
Chapter2Chapter2
Chapter2
 
MATLAB for Technical Computing
MATLAB for Technical ComputingMATLAB for Technical Computing
MATLAB for Technical Computing
 
Lec 9 05_sept [compatibility mode]
Lec 9 05_sept [compatibility mode]Lec 9 05_sept [compatibility mode]
Lec 9 05_sept [compatibility mode]
 
Chapter2
Chapter2Chapter2
Chapter2
 
Mat lab day 1
Mat lab day 1Mat lab day 1
Mat lab day 1
 
Introduction to matlab lecture 3 of 4
Introduction to matlab lecture 3 of 4Introduction to matlab lecture 3 of 4
Introduction to matlab lecture 3 of 4
 
Intro to matlab
Intro to matlabIntro to matlab
Intro to matlab
 
Matlab ch1 intro
Matlab ch1 introMatlab ch1 intro
Matlab ch1 intro
 
Ch3
Ch3Ch3
Ch3
 
Mechanical Engineering Homework Help
Mechanical Engineering Homework HelpMechanical Engineering Homework Help
Mechanical Engineering Homework Help
 
N-Queens Combinatorial Problem - Polyglot FP for fun and profit - Haskell and...
N-Queens Combinatorial Problem - Polyglot FP for fun and profit - Haskell and...N-Queens Combinatorial Problem - Polyglot FP for fun and profit - Haskell and...
N-Queens Combinatorial Problem - Polyglot FP for fun and profit - Haskell and...
 
Tutorial 2
Tutorial     2Tutorial     2
Tutorial 2
 
Introduction to matlab lecture 2 of 4
Introduction to matlab lecture 2 of 4Introduction to matlab lecture 2 of 4
Introduction to matlab lecture 2 of 4
 
Mmc manual
Mmc manualMmc manual
Mmc manual
 
matlab
matlabmatlab
matlab
 
Scala as a Declarative Language
Scala as a Declarative LanguageScala as a Declarative Language
Scala as a Declarative Language
 
Array
ArrayArray
Array
 
Matlab commands
Matlab commandsMatlab commands
Matlab commands
 
Matlab practice
Matlab practiceMatlab practice
Matlab practice
 

Viewers also liked

Matlab 3
Matlab 3Matlab 3
Matlab 3asguna
 
Matlab 2
Matlab 2Matlab 2
Matlab 2asguna
 
Chapter 3
Chapter 3Chapter 3
Chapter 3asguna
 
Chapter 4
Chapter 4Chapter 4
Chapter 4asguna
 
Dtf matlab 20150319
Dtf matlab 20150319Dtf matlab 20150319
Dtf matlab 20150319
Mehrdad Panahpour Tehrani
 
Part 1 presentation 1
Part 1 presentation 1Part 1 presentation 1
Part 1 presentation 1Gaye Aktürk
 
Lecture1 Intro To Signa
Lecture1 Intro To SignaLecture1 Intro To Signa
Lecture1 Intro To Signababak danyal
 
Assembly Language Programming By Ytha Yu, Charles Marut Chap 6 (Flow Control ...
Assembly Language Programming By Ytha Yu, Charles Marut Chap 6 (Flow Control ...Assembly Language Programming By Ytha Yu, Charles Marut Chap 6 (Flow Control ...
Assembly Language Programming By Ytha Yu, Charles Marut Chap 6 (Flow Control ...
Bilal Amjad
 
Ishiriya Wireless Technologies-MATLAB Data Acquisition
Ishiriya Wireless Technologies-MATLAB Data AcquisitionIshiriya Wireless Technologies-MATLAB Data Acquisition
Ishiriya Wireless Technologies-MATLAB Data Acquisition
bhadrah
 
Data communication lab manual
Data communication lab manualData communication lab manual
Data communication lab manualNafe Singh Yadav
 
Matlab Introduction
Matlab IntroductionMatlab Introduction
Matlab Introduction
Daniel Moore
 
Matlab Introduction
Matlab IntroductionMatlab Introduction
Matlab Introduction
ideas2ignite
 
Introduction to Digital Image Processing Using MATLAB
Introduction to Digital Image Processing Using MATLABIntroduction to Digital Image Processing Using MATLAB
Introduction to Digital Image Processing Using MATLAB
Ray Phan
 
SlideShare 101
SlideShare 101SlideShare 101
SlideShare 101
Amit Ranjan
 

Viewers also liked (16)

Matlab 3
Matlab 3Matlab 3
Matlab 3
 
Matlab 2
Matlab 2Matlab 2
Matlab 2
 
Chapter 3
Chapter 3Chapter 3
Chapter 3
 
Chapter 4
Chapter 4Chapter 4
Chapter 4
 
Dtf matlab 20150319
Dtf matlab 20150319Dtf matlab 20150319
Dtf matlab 20150319
 
Part 1 presentation 1
Part 1 presentation 1Part 1 presentation 1
Part 1 presentation 1
 
Lecture1 Intro To Signa
Lecture1 Intro To SignaLecture1 Intro To Signa
Lecture1 Intro To Signa
 
Sns slide 1 2011
Sns slide 1 2011Sns slide 1 2011
Sns slide 1 2011
 
Assembly Language Programming By Ytha Yu, Charles Marut Chap 6 (Flow Control ...
Assembly Language Programming By Ytha Yu, Charles Marut Chap 6 (Flow Control ...Assembly Language Programming By Ytha Yu, Charles Marut Chap 6 (Flow Control ...
Assembly Language Programming By Ytha Yu, Charles Marut Chap 6 (Flow Control ...
 
Ishiriya Wireless Technologies-MATLAB Data Acquisition
Ishiriya Wireless Technologies-MATLAB Data AcquisitionIshiriya Wireless Technologies-MATLAB Data Acquisition
Ishiriya Wireless Technologies-MATLAB Data Acquisition
 
Data communication lab manual
Data communication lab manualData communication lab manual
Data communication lab manual
 
Matlab Introduction
Matlab IntroductionMatlab Introduction
Matlab Introduction
 
Line coding
Line codingLine coding
Line coding
 
Matlab Introduction
Matlab IntroductionMatlab Introduction
Matlab Introduction
 
Introduction to Digital Image Processing Using MATLAB
Introduction to Digital Image Processing Using MATLABIntroduction to Digital Image Processing Using MATLAB
Introduction to Digital Image Processing Using MATLAB
 
SlideShare 101
SlideShare 101SlideShare 101
SlideShare 101
 

Similar to Matlab 1

Matlab-free course by Mohd Esa
Matlab-free course by Mohd EsaMatlab-free course by Mohd Esa
Matlab-free course by Mohd Esa
Mohd Esa
 
MATLAB-Introd.ppt
MATLAB-Introd.pptMATLAB-Introd.ppt
MATLAB-Introd.ppt
kebeAman
 
SAMPLE QUESTIONExercise 1 Consider the functionf (x,C).docx
SAMPLE QUESTIONExercise 1 Consider the functionf (x,C).docxSAMPLE QUESTIONExercise 1 Consider the functionf (x,C).docx
SAMPLE QUESTIONExercise 1 Consider the functionf (x,C).docx
agnesdcarey33086
 
More instructions for the lab write-up1) You are not obli.docx
More instructions for the lab write-up1) You are not obli.docxMore instructions for the lab write-up1) You are not obli.docx
More instructions for the lab write-up1) You are not obli.docx
gilpinleeanna
 
presentation.pptx
presentation.pptxpresentation.pptx
presentation.pptx
raghav415187
 
INTRODUCTION TO MATLAB presentation.pptx
INTRODUCTION TO MATLAB presentation.pptxINTRODUCTION TO MATLAB presentation.pptx
INTRODUCTION TO MATLAB presentation.pptx
Devaraj Chilakala
 
1.1Introduction to matlab.pptx
1.1Introduction to matlab.pptx1.1Introduction to matlab.pptx
1.1Introduction to matlab.pptx
BeheraA
 
A complete introduction on matlab and matlab's projects
A complete introduction on matlab and matlab's projectsA complete introduction on matlab and matlab's projects
A complete introduction on matlab and matlab's projects
Mukesh Kumar
 
MATLAB sessions Laboratory 2MAT 275 Laboratory 2Matrix .docx
MATLAB sessions Laboratory 2MAT 275 Laboratory 2Matrix .docxMATLAB sessions Laboratory 2MAT 275 Laboratory 2Matrix .docx
MATLAB sessions Laboratory 2MAT 275 Laboratory 2Matrix .docx
andreecapon
 
Introduction to matlab
Introduction to matlabIntroduction to matlab
Introduction to matlab
BilawalBaloch1
 
B61301007 matlab documentation
B61301007 matlab documentationB61301007 matlab documentation
B61301007 matlab documentation
Manchireddy Reddy
 
Basic of octave matlab programming language
Basic of octave matlab programming languageBasic of octave matlab programming language
Basic of octave matlab programming language
Aulia Khalqillah
 
Matlab
MatlabMatlab
Introduction to matlab
Introduction to matlabIntroduction to matlab
Introduction to matlab
Dnyanesh Patil
 
Matlab ppt
Matlab pptMatlab ppt
Matlab ppt
chestialtaff
 
Matlabch01
Matlabch01Matlabch01
Matlabch01
Mohammad Ayyash
 
An Introduction to MATLAB for beginners
An Introduction to MATLAB for beginnersAn Introduction to MATLAB for beginners
An Introduction to MATLAB for beginners
Murshida ck
 

Similar to Matlab 1 (20)

Matlab-free course by Mohd Esa
Matlab-free course by Mohd EsaMatlab-free course by Mohd Esa
Matlab-free course by Mohd Esa
 
MATLAB-Introd.ppt
MATLAB-Introd.pptMATLAB-Introd.ppt
MATLAB-Introd.ppt
 
bobok
bobokbobok
bobok
 
SAMPLE QUESTIONExercise 1 Consider the functionf (x,C).docx
SAMPLE QUESTIONExercise 1 Consider the functionf (x,C).docxSAMPLE QUESTIONExercise 1 Consider the functionf (x,C).docx
SAMPLE QUESTIONExercise 1 Consider the functionf (x,C).docx
 
More instructions for the lab write-up1) You are not obli.docx
More instructions for the lab write-up1) You are not obli.docxMore instructions for the lab write-up1) You are not obli.docx
More instructions for the lab write-up1) You are not obli.docx
 
presentation.pptx
presentation.pptxpresentation.pptx
presentation.pptx
 
INTRODUCTION TO MATLAB presentation.pptx
INTRODUCTION TO MATLAB presentation.pptxINTRODUCTION TO MATLAB presentation.pptx
INTRODUCTION TO MATLAB presentation.pptx
 
1.1Introduction to matlab.pptx
1.1Introduction to matlab.pptx1.1Introduction to matlab.pptx
1.1Introduction to matlab.pptx
 
A complete introduction on matlab and matlab's projects
A complete introduction on matlab and matlab's projectsA complete introduction on matlab and matlab's projects
A complete introduction on matlab and matlab's projects
 
Matlab1
Matlab1Matlab1
Matlab1
 
MATLAB sessions Laboratory 2MAT 275 Laboratory 2Matrix .docx
MATLAB sessions Laboratory 2MAT 275 Laboratory 2Matrix .docxMATLAB sessions Laboratory 2MAT 275 Laboratory 2Matrix .docx
MATLAB sessions Laboratory 2MAT 275 Laboratory 2Matrix .docx
 
Introduction to matlab
Introduction to matlabIntroduction to matlab
Introduction to matlab
 
Matlab booklet
Matlab bookletMatlab booklet
Matlab booklet
 
B61301007 matlab documentation
B61301007 matlab documentationB61301007 matlab documentation
B61301007 matlab documentation
 
Basic of octave matlab programming language
Basic of octave matlab programming languageBasic of octave matlab programming language
Basic of octave matlab programming language
 
Matlab
MatlabMatlab
Matlab
 
Introduction to matlab
Introduction to matlabIntroduction to matlab
Introduction to matlab
 
Matlab ppt
Matlab pptMatlab ppt
Matlab ppt
 
Matlabch01
Matlabch01Matlabch01
Matlabch01
 
An Introduction to MATLAB for beginners
An Introduction to MATLAB for beginnersAn Introduction to MATLAB for beginners
An Introduction to MATLAB for beginners
 

Recently uploaded

Assuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyesAssuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyes
ThousandEyes
 
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Thierry Lestable
 
Accelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish CachingAccelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish Caching
Thijs Feryn
 
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
DanBrown980551
 
Search and Society: Reimagining Information Access for Radical Futures
Search and Society: Reimagining Information Access for Radical FuturesSearch and Society: Reimagining Information Access for Radical Futures
Search and Society: Reimagining Information Access for Radical Futures
Bhaskar Mitra
 
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
Sri Ambati
 
The Future of Platform Engineering
The Future of Platform EngineeringThe Future of Platform Engineering
The Future of Platform Engineering
Jemma Hussein Allen
 
DevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA ConnectDevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA Connect
Kari Kakkonen
 
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
Product School
 
Essentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with ParametersEssentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with Parameters
Safe Software
 
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMsTo Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
Paul Groth
 
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Product School
 
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered QualitySoftware Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Inflectra
 
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
UiPathCommunity
 
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdfFIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance
 
"Impact of front-end architecture on development cost", Viktor Turskyi
"Impact of front-end architecture on development cost", Viktor Turskyi"Impact of front-end architecture on development cost", Viktor Turskyi
"Impact of front-end architecture on development cost", Viktor Turskyi
Fwdays
 
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
Product School
 
IOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptx
IOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptxIOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptx
IOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptx
Abida Shariff
 
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdfFIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance
 
PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)
Ralf Eggert
 

Recently uploaded (20)

Assuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyesAssuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyes
 
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
 
Accelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish CachingAccelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish Caching
 
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
 
Search and Society: Reimagining Information Access for Radical Futures
Search and Society: Reimagining Information Access for Radical FuturesSearch and Society: Reimagining Information Access for Radical Futures
Search and Society: Reimagining Information Access for Radical Futures
 
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
 
The Future of Platform Engineering
The Future of Platform EngineeringThe Future of Platform Engineering
The Future of Platform Engineering
 
DevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA ConnectDevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA Connect
 
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
 
Essentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with ParametersEssentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with Parameters
 
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMsTo Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
 
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
 
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered QualitySoftware Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
 
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
 
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdfFIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdf
 
"Impact of front-end architecture on development cost", Viktor Turskyi
"Impact of front-end architecture on development cost", Viktor Turskyi"Impact of front-end architecture on development cost", Viktor Turskyi
"Impact of front-end architecture on development cost", Viktor Turskyi
 
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
 
IOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptx
IOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptxIOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptx
IOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptx
 
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdfFIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
 
PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)
 

Matlab 1

  • 1. POLYTECHNIC UNGKU OMAR ELECTRICAL ENGINEERING DEPARTMENT Course : E5124 DATA COMMUNICATION (Lab work) Experiment : Matlab 1 – Get Familiarize (Matrices and Plot) The objective of this session is to learn: - How to launch the matlab software - Few simple calculations and formulation - Plot command and graphical output Introduction Matlab is a tool for doing numerical computations with matrices and vectors. It can also display information graphically. The best way to learn what Matlab can do is to work through some examples at the computer. After reading and familiarize with this exercise you will be able to solve construct own work. Starting MATLAB Launch MATLAB by double-clicking on the MATLAB icon on your Windows desktop. When you start MATLAB, a special window called the MATLAB desktop appears. The desktop is a window that contains other windows. The major tools within or accessible from the desktop are (refer Fig 1): - The Command Window - The Command History - The Workspace - The Current Directory - The Help Browser - The Start button 1
  • 2. Fig 1 : The graphical interface to the Matlab workspace Table below shows arithmetic operators for calculation and equation in Matlab application. As an example of a simple interactive calculation, just type the expression you want to evaluate. Let's start at the very beginning. For example, let's suppose you want to calculate the expression, 1 + 2 x 3. You type it at the prompt command (>>) as follows, 2
  • 3. >> 1+2*3 ans = 7 You will have noticed that if you do not specify an output variable, MATLAB uses a default variable ans, short for answer, to store the results of the current calculation. Note that the variable ans is created (or overwritten, if it is already existed). To avoid this, you may assign a value to a variable or output argument name. For example, >> x = 1+2*3 x= 7 will result in x being given the value 1 + 2 x 3 = 7. This variable name can always be used to refer to the results of the previous computations. Therefore, computing 4x will result in >> 4*x ans = 28.0000 Exercise 1. Matrix 1.1 Insert the following expression and observe the result. >>aa=[l 3 4; 5 7 8; 2 3 5] Observation >> y=[10; 9; 8] Observation 3
  • 4. 1.2 Insert both expressions. >>aa=[l 3 4; 5 7 8; 2 3 5]; >> y=[10; 9; 8]; Now obtain result for following expression >>aay Observation >>inv(aa)*y Observation >> [inv(aa)*y aay] Observation Explain your observation for expression [inv(aa)*y aay] _____________________________________________________________________________________ _____________________________________________________________________________________ 2. Matrix Loop 2.1 Insert following expression and obtain result 4
  • 5. >> a = [ 0.8 0.1; 0.2 0.9 ] Observation >> x = [ 1; 0 ] Observation 2.2 Type below expression and state your observation >> a = [ 0.8 0.1; 0.2 0.9 ]; >> x = [ 1; 0 ]; >> for i = 1:20, x = a*x, end Observation 5
  • 6. 3. Plot MATLAB has an excellent set of graphic tools. Plotting a given data set or the results of computation is possible with very few commands. You are highly encouraged to plot mathematical functions and results of analysis as often as possible. Trying to understand mathematical equations with graphics is an enjoyable and very e±cient way of learning mathematics. Being able to plot mathematical functions and data freely is the most important step, and this section is written to assist you to do just that. 3.1 Let say, your given few samples of variable which need to find out their performance rate. Now, insert following expression:- >> a=[1 2 3 4 6 4 3 4 5] Observation >> b=a+2 Observation 3.2 Use plot command to plot your result. >> plot(b) Observation >> grid on Observation 6
  • 7. 3.3 Use label and title command to provide information at graph. Type this command step by step in order to observe result. Before you type command, display your Matlab window panel and graph window side by side in order to get better view. >> xlabel('Sequence of b') >> ylabel('b value') >> title(‘Graphical output for b sequence of number’) Observation 3.4 Bar command used to plot bar graph which able to show us the statistical result. >> bar(b) >> xlabel('Number of sample') >> ylabel('Weight of random samples in kg') Observation 7
  • 8. >> plot(b,'*') >> axis([0 12 0 10]) Observation What did you see from both graphs? Explain. ______________________________________________________________________________________ ______________________________________________________________________________________ 3.5 To make a graph of y = sin(t) on the interval t = 0 to t = 10, do the following steps: >> t = 0:.3:10; >> y = sin(t); >> plot(t,y) >> title('Sine wave ') >> xlabel(‘Time, t') >> ylabel('Amplitude') Observation 8
  • 9. 3.6 Plotting multiple wave or result in single graph. Execute following command and make your observation. Insert title and label by yourself. >> t=0:0.1:30; >> y1=sin(t); >> y2=cos(t); >> plot(t,y1,'--',t,y2,'-r') Observation >> t=0:0.1:30; >> y1=sin(t).*t; >> y2=cos(t).*t; >> plot(t,y1,'--',t,y2,'-r') Observation 9
  • 10. 3.7 Subplot The subplot is used to put multiple plots on the same MATLAB figure window. subplot(pqr) - p & q represent matrixes, r locating position for plotted graph a) Write the following expression and obtain the result. >> x = 0 : 0.1 : 3 *pi; >> y = sin(x); >> z = cos(x); >> subplot(222) >> plot(x,y) >> title('Sine wave y') >> xlabel('time, x') >> ylabel('Amplitude, y') >> subplot(223) >> title('x and z') >> subplot(224) >> plot(x,y,'-',x,z,' -- ') >> title('x and [y z]') b) Once complete your subplot, insert label and title for each graph individually. Use example as given in above command. Observation 10
  • 11. c) Discrete sample graphical output. Type following command and make observation. State the differences between both results. >> p=0:0.05:5; >> q=sin(p.^2); >> plot(p,q); Observation >> p=0:0.05:5; >> q=sin(p.^2); >> stem(p,q); Observation Reflection _____________________________________________________________________________________________ _____________________________________________________________________________________________ _____________________________________________________________________________________________ _____________________________________________________________________________________________ 11