randminv

by Tim C. Lueth, SG-Lib Toolbox: SolidGeometry 5.6 - Auxiliary function
Introduced first in SolidGeometry 4.4, Creation date: 2018-11-07, Last change: 2025-09-14

returns a random fnct that has a minimal value



See Also: , randol

Example Illustration

 missing image of randminv(r,c,rmin)

Syntax

r=randminv(r,c,[rmin])

Input Parameter

r: rows
c: cols
rmin: minimal value or [rmin rmax]; default is [rmin 1]

Output Parameter

r: random matrix




Copyright 2018-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, randminv, generates a random matrix with specified dimensions and a minimum value. It is part of the SolidGeometry library and was introduced in version 4.4.

Input Parameters

Output

Algorithm Steps

  1. Check the number of input arguments using nargin. If only one argument is provided, set varargin{1} to r, and default r and c to 1.
  2. Retrieve the minimum value or range using getfuncparams with a default of 0 if not specified.
  3. If rmin is a scalar, convert it to a two-element vector [rmin, 1].
  4. Generate a random matrix r with dimensions (r, c) using the rand function.
  5. Scale and shift the random values to fit within the specified range [rmin(1), rmin(2)] using the formula: r = r * (rmin(2) - rmin(1)) + rmin(1).
Algorithm explaination created using ChatGPT on 2025-08-18 22:25. (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