lowpassResample
Description
Examples
Sample a sine wave at pi samples per cycle.
t = (0:20)*2; v = sin(t);
Define the interpolation sample times.
tq = (0:400)*0.1;
Define the interpolation configuration.
config.OutputRiseFall = 2; %Fixed step sample interval config.NDelay = 5; config.SampleMode = 'fixed'; config.CausalMode = 'off';
Perform the interpolation.
[vq,vdq]=lowpassResample(t,v,tq,config);
Scatter plot the samples, plot the interpolated data, and plot the original sine wave.
scatter(t,v); hold on; plot(tq,vq); plot(tq,sin(tq)); hold off; title('Interpolated Data'); legend('samples','interpolated data','original sine wave');
Plot the interpolated derivative and the original derivative.
plot(tq,vdq); hold on; plot(tq,cos(tq)); hold off; title('Interpolated Derivative'); legend('interpolated derivative','original derivative');
Input Arguments
Input sample times, specified as a fixed-step or variable-step vector.
Data Types: single
| double
| int8
| int16
| int32
| uint8
| uint16
| uint32
| logical
Input sample values corresponding to the input sample times defined in
t
, specified as a vector.
Data Types: single
| double
Output sample times, specified as a fixed-step or variable-step vector.
Data Types: single
| double
Interpolation parameters, specified as a structure with fields.
Field | Description | Value | Default |
---|---|---|---|
OutputRiseFall | The 0%–100% rise/fall time of the interpolated output. | Positive real scalar | 1e-10 |
NDelay | Number of rise/fall times by which the interpolated output will be delayed with respect to the input. | Positive real integer | 1 |
SampleMode | Input sampling mode, either fixed-step discrete time or variable-step discrete time. | fixed , variable | variable |
CausalMode | Determine whether you want the interpolation process to introduce delay.
Select CausalMode to introduce enough delay between input and
output samples in the interpolation process so that the process is strictly
causal. | off , on | off |
Data Types: struct
Output Arguments
Interpolated samples, returned as a vector.
Data Types: single
| double
Derivative of interpolated samples corresponding to vq
,
returned as a vector.
Data Types: single
| double
More About
You can define the number of rise/fall times by which the interpolated
output will be delayed with respect to the input using the
config.NDelay
parameter.
The default value of config.NDelay
of 1 produces an interpolation
that has no ringing due to the Gibbs phenomenon and also has modest rejected out of band
numerical artifacts.
Setting config.NDelay
to 5 introduces enough anti-aliasing
filtering to satisfy most applications, but introduces ringing due to the Gibbs
phenomenon.
Setting config.NDelay
to 10 introduces enough anti-aliasing
filtering to satisfy demanding applications, but at the cost of additional delay and
computation.
Setting config.NDelay
to greater than 10 is supported, but is not
required normally.
You can define the input sampling mode using the
config.SampleMode
parameter.
The default value of config.SampleMode
of
variable
assumes that the input values are the result of a zero order
hold process. In this case, the signal value is always equal to the value of the most recent
sample. This choice is appropriate for saturated signals for which the transition times are
the most important consideration.
Setting 'config.SampleMode
to fixed
assumes that
the input values are instantaneous samples of a mathematically continuous signal at
uniformly spaced sample times. Use this option for signals that are subject to a significant
amount of analog filtering.
You can define the interpolation process as causal or not using the
config.SampleMode
parameter.
The default value of config.CausalMode
of off
aligns the time scale of the interpolation with the time scale of the input. This is
appropriate when all necessary input values are available in a single vector.
Setting config.CausalMode
to on
introduces
enough delay so that the sample values are available before performing an interpolation. The
interpolated sample times are therefore always delayed by a constant value with respect to
the input sample times. The required additional delay in this mode is
config.OutputRiseFall
times config.NDelay
. This
behavior mimics the behavior of the Lowpass Resampler
block.
Extended Capabilities
C/C++ Code Generation
Generate C and C++ code using MATLAB® Coder™.
Version History
Introduced in R2021a
See Also
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
웹사이트 선택
번역된 콘텐츠를 보고 지역별 이벤트와 혜택을 살펴보려면 웹사이트를 선택하십시오. 현재 계신 지역에 따라 다음 웹사이트를 권장합니다:
또한 다음 목록에서 웹사이트를 선택하실 수도 있습니다.
사이트 성능 최적화 방법
최고의 사이트 성능을 위해 중국 사이트(중국어 또는 영어)를 선택하십시오. 현재 계신 지역에서는 다른 국가의 MathWorks 사이트 방문이 최적화되지 않았습니다.
미주
- América Latina (Español)
- Canada (English)
- United States (English)
유럽
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)