represents the single-input, single-output model of a sampler.
SamplerModel[specs]
represents a sampler with specification specs.
SamplerModel
represents the single-input, single-output model of a sampler.
SamplerModel[specs]
represents a sampler with specification specs.
Details
- SamplerModel is also known as a sampler or regular sampling.
- SamplerModel is typically used to convert a continuous-time signal coming from sensors to a discrete-time signal used by a digital microcontroller or digital signal processor.
- A sampler is the model of an operation that takes a continuous-time signal
and samples it at periodic intervals to generate a discrete-time signal
, where
is the sampling period. - When simulating a system using InputOutputResponse that includes a SamplerModel, it will be a mixed continuous-time and discrete-time system. In that case, all discrete-time signals are treated as piecewise constant value and continuous-time signals.
- The specification spec is an association and can have the following keys:
-
"InputVariables" {u[t]} input variables "OutputVariables" {y[t]} output variables "SamplingPeriod" 1 sampling period "SignalCount" 1 number of inputs and outputs "TemporalVariable" t temporal variable - SamplerModel[…]["prop"] can be used to obtain various properties of the model.
- The value of "prop" can be any of the keys in spec and the following:
-
"Properties" list of property names "PropertyAssociation" property names and values as an association "PropertyDataset" property names and values as a dataset {p1,p2,…} values of properties pi
Examples
open all close allBasic Examples (2)
SamplerModel[]%["PropertyDataset"]Simulate the response of a sampler to a sinusoidal input:
r = InputOutputResponse[SamplerModel[], Sin[t], {t, 0, 2π}]Plot the input signal and the sampler's response:
Plot[{Sin[t], r}, {t, 0, 2π}]Scope (9)
A single-input, single-output sampler model:
SamplerModel[]A sampler with 2 inputs and outputs:
SamplerModel[<|"SignalCount" -> 2|>]A sampler with custom properties:
SamplerModel[<|"InputVariables" -> u[t], "OutputVariables" -> y[t], "TemporalVariable" -> t|>]%["Dataset"]List all available properties:
SamplerModel[Association["DiscreteVariables" -> {Subscript[, 1][t]}, "InputVariables" -> {u[t]},
"OutputVariables" -> {y[t]}, "InitialStateValues" -> {}, "TemporalVariable" -> t,
"WhenEvent" -> Mod[t, 1] == 0, "WhenEventAction" -> {Subscript ... ent", "WhenEventAction", "StateEquations",
"OutputExpressions", "SignalCount", "Type", "PropertyFunction", "SamplingPeriod",
"SummaryItems"}], {"InputVariables", "OutputVariables", "SamplingPeriod", "SignalCount",
"TemporalVariable"}]["Properties"]SamplerModel[Association["DiscreteVariables" -> {Subscript[, 1][t]}, "InputVariables" -> {u[t]},
"OutputVariables" -> {y[t]}, "InitialStateValues" -> {}, "TemporalVariable" -> t,
"WhenEvent" -> Mod[t, 1] == 0, "WhenEventAction" -> {Subscript ... ent", "WhenEventAction", "StateEquations",
"OutputExpressions", "SignalCount", "Type", "PropertyFunction", "SamplingPeriod",
"SummaryItems"}], {"InputVariables", "OutputVariables", "SamplingPeriod", "SignalCount",
"TemporalVariable"}]["SamplingPeriod"]SamplerModel[Association["DiscreteVariables" -> {Subscript[, 1][t]}, "InputVariables" -> {u[t]},
"OutputVariables" -> {y[t]}, "InitialStateValues" -> {}, "TemporalVariable" -> t,
"WhenEvent" -> Mod[t, 1] == 0, "WhenEventAction" -> {Subscript ... ent", "WhenEventAction", "StateEquations",
"OutputExpressions", "SignalCount", "Type", "PropertyFunction", "SamplingPeriod",
"SummaryItems"}], {"InputVariables", "OutputVariables", "SamplingPeriod", "SignalCount",
"TemporalVariable"}][{"SamplingPeriod", "SignalCount"}]Obtain the properties as an association:
SamplerModel[Association["DiscreteVariables" -> {Subscript[, 1][t]}, "InputVariables" -> {u[t]},
"OutputVariables" -> {y[t]}, "InitialStateValues" -> {}, "TemporalVariable" -> t,
"WhenEvent" -> Mod[t, 1] == 0, "WhenEventAction" -> {Subscript ... ent", "WhenEventAction", "StateEquations",
"OutputExpressions", "SignalCount", "Type", "PropertyFunction", "SamplingPeriod",
"SummaryItems"}], {"InputVariables", "OutputVariables", "SamplingPeriod", "SignalCount",
"TemporalVariable"}]["PropertyAssociation"]SamplerModel[Association["DiscreteVariables" -> {Subscript[, 1][t]}, "InputVariables" -> {u[t]},
"OutputVariables" -> {y[t]}, "InitialStateValues" -> {}, "TemporalVariable" -> t,
"WhenEvent" -> Mod[t, 1] == 0, "WhenEventAction" -> {Subscript ... ent", "WhenEventAction", "StateEquations",
"OutputExpressions", "SignalCount", "Type", "PropertyFunction", "SamplingPeriod",
"SummaryItems"}], {"InputVariables", "OutputVariables", "SamplingPeriod", "SignalCount",
"TemporalVariable"}]["PropertyDataset"]Simulate the response of a sampler to a decaying sinusoid:
r1 = InputOutputResponse[SamplerModel[], inp = E^-tSin[ 4t], {t, 0, 8}]Plot[{inp, r1}, {t, 0, 8}, PlotRange -> All]Decrease the sampling period to obtain better sampling:
r2 = InputOutputResponse[SamplerModel[<|"SamplingPeriod" -> 0.25|>], inp, {t, 0, 8}]Plot[{inp, r2}, {t, 0, 8}, PlotRange -> All]The lower sampling period results in better sampling:
NIntegrate[Abs /@ {inp - r1[[1]], inp - r2[[1]]}, {t, 0, 8}]Applications (1)
A sampler model is a subsystem of a sampled data system:
csys = SystemsConnectionsModel[{StateSpaceModel[{{{2}}, {{1}}, {{1}}, {{1}}}],
StateSpaceModel[{{{0.951219512195122}}, {{-5.853658536585367, 6.829268292682928}},
{{0.009756097560975611}}, {{-0.029268292682926834, 0.03414634146341464}}},
Sampli ... OutputVariables", "SamplingPeriod", "SignalCount",
"TemporalVariable"}]}, {{5, 1} -> {4, 1}, {4, 1} -> {6, 1}, {4, 1} -> {2, 1}, {6, 1} -> {1, 1},
{1, 1} -> {7, 1}, {7, 1} -> {2, 2}, {2, 1} -> {3, 1}, {3, 1} -> {4, 2}}, {{5, 1}}, {{1, 1}}];or = InputOutputResponse[csys, UnitBox[t - 0.5], {t, 0, 5}]Plot[or, {t, 0, 5}, PlotRange -> All]Properties & Relations (4)
A sampler model is essentially a zero-order interpolation with zero initial values:
u = Cos[t];
sp = 0.5;Join[{{0, 0}}, Table[{t, u}, {t, sp, 2π, sp}]];
r1 = Interpolation[%, t - sp, InterpolationOrder -> 0]The response of the sampler model:
r2 = InputOutputResponse[SamplerModel[<|"SamplingPeriod" -> sp|>], u, {t, 0, 2π}]Plot[{r1, r2}, {t, 0, Round[2π]}]A sampler model is essentially a time-based action:
u = Cos[t];
sp = 0.5;The response based on WhenEvent:
r1 = NDSolveValue[{WhenEvent@@{Mod[t, sp] == 0, y[t] -> u}, y[0] == 0, Derivative[1][$][t] == 0, $[0] == 0}, y[t], {t, 0, 2 π}, DiscreteVariables -> {y[t]}]The response of the sampler model:
r2 = InputOutputResponse[SamplerModel[<|"SamplingPeriod" -> sp|>], u, {t, 0, 2π}]Plot[{r1, r2}, {t, 0, 2π}]A holder model inverses the operation of a sampler model:
f = 3;
u = Sin[3 t];
sp = 1 / (100 f);A sampler model in series with a holder model:
sys = SystemsConnectionsModel[{SamplerModel[<|"SamplingPeriod" -> sp|>], HolderModel[<|"SamplingPeriod" -> sp|>]}, {{1, 1} -> {2, 1}}, {{1, 1}}, {{2, 1}}]The output signal is the same as the input signal:
InputOutputResponse[sys, u, {t, 0, 2π}];
Plot[{u, %[[1]]}, {t, 0, 2π}]The Nyquist–Shannon sampling theorem says that the sampling frequency must be at least twice that of the input signal frequency to reconstruct the input signal from the sampled signal:
f = 3;
u = Sin[f t];A function that connects a sampler model and a holder model in series:
sys[sp_] := SystemsConnectionsModel[{SamplerModel[<|"SamplingPeriod" -> sp|>], HolderModel[<|"SamplingPeriod" -> sp|>]}, {{1, 1} -> {2, 1}}, {{1, 1}}, {{2, 1}}]The output signal when the input is sampled at 10 times the frequency of the input signal:
InputOutputResponse[sys[1 / (10 f)], u, {t, 0, 2π}];
Plot[{u, %[[1]]}, {t, 0, 2π}]Sampling at 0.5 times the input frequency results in a poor reconstruction of the signal:
InputOutputResponse[sys[1 / (0.5 f)], u, {t, 0, 2π}];
Plot[{u, %[[1]]}, {t, 0, 2π}]See Also
Related Guides
History
Text
Wolfram Research (2024), SamplerModel, Wolfram Language function, https://reference.wolfram.com/language/ref/SamplerModel.html.
CMS
Wolfram Language. 2024. "SamplerModel." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/SamplerModel.html.
APA
Wolfram Language. (2024). SamplerModel. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/SamplerModel.html
BibTeX
@misc{reference.wolfram_2026_samplermodel, author="Wolfram Research", title="{SamplerModel}", year="2024", howpublished="\url{https://reference.wolfram.com/language/ref/SamplerModel.html}", note=[Accessed: 13-June-2026]}
BibLaTeX
@online{reference.wolfram_2026_samplermodel, organization={Wolfram Research}, title={SamplerModel}, year={2024}, url={https://reference.wolfram.com/language/ref/SamplerModel.html}, note=[Accessed: 13-June-2026]}