PLplotdiscretesample

by Tim C. Lueth, SG-Lib Toolbox: SolidGeometry 5.6 - PL/Point Lists
Introduced first in SolidGeometry 5.0, Creation date: 2021-02-07, Last change: 2025-09-15

plots a PL as a digital signal to avoid problem of misinterpretation

Description

educational function for teaching mechatronics.
In contrast to PL plot, this function creates an double sampled function that makes jumps

See Also: PLplotdiscretetime , PLplot , lplots

Example Illustration

 missing image of PLplotdiscretesample(PL,)

Syntax

h=PLplotdiscretesample(PL,[])

Input Parameter

PL: Signal [k x()]

Output Parameter

h: handle to plot

Examples


SGfigure; PLplotdiscretesample([[0:20]',sin([0:20]/4)'],'b*--'); axis normal




Copyright 2021-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, PLplotdiscretesample, is designed to plot a piecewise linear (PL) signal as a digital signal to avoid misinterpretation. It is part of the SolidGeometry library and is used for educational purposes in teaching mechatronics.

Input Parameters

Output

Algorithm Steps

  1. Check if PL is a table. If it is, convert it to an array using table2array and store the original table in TPL.
  2. Ensure that PL has more rows than columns. If not, transpose PL.
  3. If PL has only one column, create a new matrix with an index column starting from 0 and append the original PL as the second column.
  4. Create a new matrix PLD with the first column of PL and a column of zeros.
  5. Call the function lplots with PLD, PL, and any additional arguments from varargin to generate the plot.
  6. If TPL is not empty, set the x-axis and y-axis labels using the variable names from TPL. If the input PL has a name, use it as the plot title.

Example Usage

The function can be used as follows:

SGfigure; PLplotdiscretesample([[0:20]',sin([0:20]/4)'],'b*--'); axis normal

This example creates a plot of a sine wave sampled at discrete intervals.

Algorithm explaination created using ChatGPT on 2025-08-19 00:54. (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