# MATLAB Programming/Fundamentals of MATLAB

[MATLAB Programming\|/MATLAB Programming]m]
Chapter 1: MATLAB ._.
    Fundamentals of MATLAB
    MATLAB Workspace
    MATLAB Variables
    *.mat files
Chapter 2: MATLAB Concepts
    MATLAB operator
    Data File I/O
Chapter 3: Variable Manipulation
    Numbers and Booleans
    Strings
    Portable Functions
    Complex Numbers
Chapter 4: Vector and matrices
    Vector and Matrices
    Special Matrices
    Operation on Vectors
    Operation on Matrices
    Sparse Matrices
Chapter 5: Array
    Arrays
    Introduction to array operations
    Vectors and Basic Vector Operations
    Mathematics with Vectors and Matrices
    Struct Arrays
    Cell Arrays
Chapter 6: Graphical Plotting
    Basic Graphics Commands
    Plot
    Polar Plot
    Semilogx or Semilogy
    Loglog
    Bode Plot
    Nichols Plot
    Nyquist Plot
Chapter 7: M File Programming
    Scripts
    Comments
    The Input Function
    Control Flow
    Loops and Branches
    Error Messages
    Debugging M Files
Chapter 8: Advanced Topics
    Numerical Manipulation
    Advanced File I/O
    Object Oriented Programming
    Applications and Examples
    Toolboxes and Extensions
Chapter 9: Bonus chapters
    MATLAB Benefits and Caveats
    Alternatives to MATLAB
    [MATLAB_Programming/GNU_Octave|What is Octave= (8) hsrmonic functions]
    Octave/MATLAB differences

## Main screen of MATLAB

When the MATLAB is opened for the first time after installing, you will see the MATLAB main display shown as followed (Note that the version is R2020a, which other versions may look more or less similar):
The main screen of MATLAB will consists of the following (in order from top to bottom):
* Search Bar - Can search the documentations online for any commands / functions / class
* Menu Bar - The shortcut keys on top of the window to access commonly used features such as creating new script, running scripts or launching SIMULINK
   * Home Tab - Commonly used features/functions are grouped here
   * Plots Tab - The plot charts is shown here. Basic charts (without additional toolbox are shown as follows):
       Line Plots, Bar Plots, Scatter Plots, Pie Chart, Histogram, Polar Plots, Geographic Plots, Contour Plots,3D Surface, Vector Field and Analytic Plots
   * Apps Tab - The additional installed toolbox with related functionality are shown here
* Current Folder Panel — The created files are accessed at this panel
* Command Window Panel — All of the workings are done at this panel, enter commands at the command line, indicated by the prompt (>>).
* Workspace Panel — Explore data that you had created or import the data from files at this panel

## Hello World

All programming languages are introduced by the most famous computer program on the planet, "Hello, world!", so let's begin with that.
In the center, you can see a window labelled as "Command Window". The cursor should be already flickering there; all you now have to do is to write as followed:
disp('Hello, world!');
and press the return key. The output will be shown just below the command as
Hello, world!
Note: To pass the argument string in single quotes (not double), but why so? Because we might need to use double quotes inside the string and that would be interpreted as the end of the string argument. Having said this, it is assured that double quotes work inside the string, however escape sequences may have to be used to get the string right.

## Start afresh

In MATLAB , once you are started working with a lot of mathematical formulas for one project , you will need to start afresh for your new project.
To do this, just type as follows:
What does this three lines do ?
clear - This command will removes all stored variables from the workspace.
clc - This command will clear the command window and homes the cursor.
close all - This command will closes all the open figure windows.

### References

* ↑ https://web.archive.org/web/20210615132903/https://www.educba.com/matlab-free/?source=leftnav