ICM Lab Experiment 2
ICM Lab Experiment 2
• what:
• cd:
• pwd:
• type:
• mkdir:
• edit:
3. Concatenation of Arrays:
How to join two vectors in one row or in one column or in a form of matrix (both vectors
act as two rows OR two columns).
How to join matrices.
6. Logical Indexing:
• Define logical indexing and its purpose.
• Make a vector and write a short code to:
o Find the number of elements greater than a threshold (take any value)
using logical indexing.
o Modify those elements that greater than a threshold using logical
indexing.
7. Plotting:
• Explain how to create a plot when two vectors x and y are given by writing a
short program to demonstrate:
o Adding a title to the plot.
o Changing the x and y limits.
o Adding x and y labels.
o Changing the fonts size
o Plotting two graphs on the same figure.
o Adding legends to distinguish between plots.
9. Observations:
Write your observations about MATLAB based on your experience in this experiment. For
example:
• What precautions should you take while joining two matrices together? Describe the
conditions required to concatenate two matrices (e.g., compatible dimensions).
• Why is it important to save plots?
• How can logical indexing and relational operators improve code efficiency?
References:
1. MATLAB Documentation
2. MATLAB Functions
3. MATLAB Operators and Special Characters
4. Array Indexing
5. Matrix Indexing in MATLAB
6. Plot