# SAMPLE TIME , SIMULATION TIME , STEPSIZE IN DETAIL

1 view (last 30 days)
prashanna kumar on 7 Nov 2022
Answered: Paul on 5 Jan 2023
DIFFERENCE BETWEEN SAMPLE TIME AND STEPSIZE AND SIMULATION TIME

John D'Errico on 5 Jan 2023
Edited: John D'Errico on 5 Jan 2023
This is not remotely a question about MATLAB. But since these words are often used by many of the tools in MATLAB, I'll assume you are asking about how they are used IN MATLAB.
They are just words. And words carry subtle connotations, but different people will often use different words to mean the same things, or the same words will mean something different to someone else than to you. In the end, they mean exactly what the writer of the software you are hoping to use wants them to mean, nothing more, nothing less. Lacking any context, they can easily mean different things to different people. As I would interpret those phrases:
"Stepsize" is generally intended to mean the stride length between consecutive steps.
x = 0:0.2:10;
so the stepsize there is 0.2. Note that stepsize need not indicate a TIME step. So stepsize may be used in physical problems where the step is a spatial increment, so units of length. But stepsize may also be a time increment.
"Sample time" is most likely used to indicate overall time of an experiment, or in some cases, it may possibly indicate an increment in time, much like stepsize. However, sample time would essentially always have units of time.
"Simulation time" would (I think) almost always indicate the total time a simulation would be run over. It implies that a simulation will be done, and indicates the total length of the simulation. Again, simulation time will again have units of time, but nothing stops the user from solving other non-temporal problems.
For example, in context of a solver like ODE45, we would find:
help ode45
ODE45 Solve non-stiff differential equations, medium order method. [TOUT,YOUT] = ODE45(ODEFUN,TSPAN,Y0) integrates the system of differential equations y' = f(t,y) from time TSPAN(1) to TSPAN(end) with initial conditions Y0. Each row in the solution array YOUT corresponds to a time in the column vector TOUT. * ODEFUN is a function handle. For a scalar T and a vector Y, ODEFUN(T,Y) must return a column vector corresponding to f(t,y). * TSPAN is a two-element vector [T0 TFINAL] or a vector with several time points [T0 T1 ... TFINAL]. If you specify more than two time points, ODE45 returns interpolated solutions at the requested times. * YO is a column vector of initial conditions, one for each equation. [TOUT,YOUT] = ODE45(ODEFUN,TSPAN,Y0,OPTIONS) specifies integration option values in the fields of a structure, OPTIONS. Create the options structure with odeset. [TOUT,YOUT,TE,YE,IE] = ODE45(ODEFUN,TSPAN,Y0,OPTIONS) produces additional outputs for events. An event occurs when a specified function of T and Y is equal to zero. See ODE Event Location for details. SOL = ODE45(...) returns a solution structure instead of numeric vectors. Use SOL as an input to DEVAL to evaluate the solution at specific points. Use it as an input to ODEXTEND to extend the integration interval. ODE45 can solve problems M(t,y)*y' = f(t,y) with mass matrix M that is nonsingular. Use ODESET to set the 'Mass' property to a function handle or the value of the mass matrix. ODE15S and ODE23T can solve problems with singular mass matrices. ODE23, ODE45, ODE78, and ODE89 are all single-step solvers that use explicit Runge-Kutta formulas of different orders to estimate the error in each step. * ODE45 is for general use. * ODE23 is useful for moderately stiff problems. * ODE78 and ODE89 may be more efficient than ODE45 on non-stiff problems that are smooth except possibly for a few isolated discontinuities. * ODE89 may be more efficient than ODE78 on very smooth problems, when integrating over long time intervals, or when tolerances are tight. Example [t,y]=ode45(@vdp1,[0 20],[2 0]); plot(t,y(:,1)); solves the system y' = vdp1(t,y), using the default relative error tolerance 1e-3 and the default absolute tolerance of 1e-6 for each component, and plots the first component of the solution. Class support for inputs TSPAN, Y0, and the result of ODEFUN(T,Y): float: double, single See also ODE23, ODE78, ODE89, ODE113, ODE15S, ODE23S, ODE23T, ODE23TB, ODE15I, ODESET, ODEPLOT, ODEPHAS2, ODEPHAS3, ODEPRINT, DEVAL, ODEEXAMPLES, FUNCTION_HANDLE. Documentation for ode45 doc ode45 Other uses of ode45 dlarray/ode45
In there, we see the input argument TSPAN. In fact, the help repeatedly refers to TSPAN as it it has units of time, but nothing stops you from solving an ODE where the independent variable is a spatial one.
I'm not at all sure this answers your question, but then I'm not really sure what your question asks, or what software you are thinking about where these terms are used. It may be a question about a tool like Simulink, or one of the ODE solvers. It might even be in context of a tool like simulated annealing, where time is just used purely by way of analogy. And I am sure there are other codes that use these same phrases in some other context.

Paul on 5 Jan 2023
Assuming this Question is in regards to Simulink:
SIMULATION TIME: Refers to the master clock of the Simulink simulation.
SAMPLE TIME: Each block has a sample time that determines when the block output is calculated during simulation. Sample Time
STEPSIZE: Size of the step that solver takes from the current solution to the next solution. Can be fixed or variable. Solver

### Categories

Find more on Sources in Help Center and File Exchange

R2022b

### Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!