File Exchange

image thumbnail

Zero Order Hold with variable time step

version 1.0 (8.76 KB) by

Level-2 M-file S-function that acts as a ZOH sampler with sample times specified as a block input.



View License

This submission demonstrates how to write a level-2 M-file S-function with a variable sample time.

The block samples and holds an input signal were the inter-sample period is specified by another input signal (and may vary from time period to time period).

Each step size must be positive or an error is thrown.

Comments and Ratings (3)

Zeren LU

How to use it with fixed-step solver?

Ketan Dewan

Phil Goddard

Phil Goddard (view profile)

In R2014b (and later releases) function names have became strictly case sensitive. Hence, to get the model to execute you need to rename VariableTimeSfun.m to be VariableTimeSFun.m -- note that "f" needs to be changed to "F".

MATLAB Release
MATLAB 7.10 (R2010a)

Inspired by: Pulse with jitter

Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.

» Watch video

Win prizes and improve your MATLAB skills

Play today