Syntax
DN=imat(D)
Input Parameter
Output Parameter
DN : | | matrix plus row column and column row |
Examples
D=imat(rand(3,5))
Copyright 2017-2025 Tim C. Lueth. All rights reserved. The code is the property of Tim C. Lueth and may not be redistributed or modified without explicit written permission. This software may be used free of charge for academic research and teaching purposes only. Commercial use, redistribution, modification, or reverse engineering is strictly prohibited. Access to source code is restricted and granted only under specific agreements. For licensing inquiries or commercial use, please contact: Tim C. Lueth
Algorithm (Workflow)
This function, named imat
, is designed to process a 2x2 matrix input and return a modified matrix that includes additional row and column indices.
Input Parameters
- D: A matrix of size 2x2. This is the primary input to the function.
Output Results
- DN: The output is a matrix that includes the original matrix
D
with additional row and column indices.
Algorithm Explanation
The function imat
performs the following steps:
- It first creates a row vector from 1 to the number of columns in
D
using 1:size(D,2)
. This vector represents the column indices of the matrix D
.
- This row vector is then concatenated with the original matrix
D
to form a new matrix. This operation is performed using the syntax [1:size(D,2);D]
, which adds the column indices as the first row of the new matrix.
- Next, a column vector is created from 0 to the number of rows in the newly formed matrix using
[0:size(DN,1)-1]'
. This vector represents the row indices of the new matrix.
- This column vector is then concatenated with the newly formed matrix from step 2. The operation
[[0:size(DN,1)-1]' DN]
adds the row indices as the first column of the final output matrix DN
.
Example
To illustrate the function, consider the example:
D = imat(rand(3,5))
In this example, a random 3x5 matrix is generated using rand(3,5)
. The function imat
is then applied to this matrix, resulting in a new matrix DN
that includes the original matrix with additional row and column indices.
Algorithm explaination created using ChatGPT on 2025-08-18 21:48. (Please note: No guarantee for the correctness of this explanation)
Last html export of this page out of FM database by TL: 2025-09-21