imat

by Tim C. Lueth, SG-Lib Toolbox: SolidGeometry 5.6 - Auxiliary function
Introduced first in SolidGeometry 3.9, Creation date: 2017-06-05, Last change: 2025-09-14

returns a matrix including row column and column row



See Also: imat , removeimat

Example Illustration

 missing image of imat(D)

Syntax

DN=imat(D)

Input Parameter

D: matrix 2x2

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

Output Results

Algorithm Explanation

The function imat performs the following steps:

  1. 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.
  2. 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.
  3. 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.
  4. 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