Chebyshev Type II Design — Control Systems/Polynomials
Control_Systems/Polynomials/Chebyshev_Type_II_Design · 1 input / 2 output port(s) at insert · exports to Python, MATLAB, Java, Rust, C, C++, VHDL, Verilog, SystemVerilog, PLC Structured Text
Description#
The block's own DESCRIPTION_HTML, rendered verbatim — the same text the config dialog's info panel and the library navigator show. Fix a wrong sentence in the block's .cpp (R-D9), never here.
Chebyshev Type II Design
Control Systems / Polynomials
Designs a digital Chebyshev Type II filter of order N and
reports its coefficients, with the cutoff arriving on a port. It is
MATLAB's cheby2: the analog flat-passband, equiripple-stopband
prototype, denormalized to the cutoff and mapped to z by the bilinear
transform prewarped at that same cutoff, so the stopband edge sits at exactly
fc.
A Type II filter is the Type I turned inside out: the passband is flat and the ripple lives in the stopband, bounded by the attenuation asked for. Everything follows from one number, T = tan(πfc/fs); both polynomials are then divided by a[0], so the denominator is monic and the answer is MATLAB's exactly.
It designs; it does not filter. Feed b and a to Discrete / Transfer Fcn Direct Form II Time Varying, which takes them on ports and so retunes with them.
Ports
- fc – the stopband-edge frequency in Hz: the point at which the response first reaches the stated attenuation. Scalar. This is not a passband edge – see Notes. Clamped into (0, fs/2).
- b – the numerator's coefficients, descending powers of z, as a column of N + 1 entries.
- a – the denominator's, the same length, with a[0] = 1.
Parameters
- Order – N, a whole number from 1 to 8. Both outputs are N + 1 long. Default 3.
- Filter Type – which prototype mapping is used:
- Lowpass – passes below the cutoff. Default.
- Highpass – passes above it. The same prototype with s and 1/s exchanged, which swaps the roles of (z−1) and (z+1).
- Stopband Attenuation (dB) – Rs, how far down the stopband ripple is held, in decibels. From 3 to 200. A larger value pushes the stopband further down and softens the transition. Default 40.
- Sample Rate (Hz) – fs, the rate the filter is designed FOR, and the rate the cutoff is measured against. Strictly positive. This is not the block's own rate. Default 100.
- Sampling Time (s) – zero or less inherits the solver's rate; a positive value runs the block at that period.
Code export
All ten targets: Python, MATLAB, Java, Rust, C, C++, VHDL, Verilog, SystemVerilog and PLC Structured Text. The order, the type, the attenuation and the rate are structural and are baked into the generated body, so nothing is exposed as a tunable parameter on the generated core; the prototype coefficients and the integer expansions are inlined. This block inlines two weight matrices where the others in its family inline one and a vector, because its numerator is a polynomial.
The three HDL targets are simulation-only, and deliberately: a
tangent and a reciprocal do not belong in a Q16.16 datapath. Both
are evaluated in real and the values convert at the port boundary,
which is what the Trigonometry family does for the same reason. The seven
software targets are exact.
Simulink bridge
None (Support::None). cheby2 is a MATLAB
function, and the two Simulink blocks that carry a Chebyshev Type II design
– Analog Filter Design and Lowpass IIR Filter Design, both
in the DSP System Toolbox's design library – do the design internally and
expose no part of it: each takes a signal in and gives a filtered signal out, so
neither has coefficients a diagram could read. There is therefore no library
path this block could name. The bridge reports it rather than dropping it
silently, and it has no parity testbench; code export verification still
covers it across all ten languages. No configuration of it crosses either,
including "Sampling Time (s)", which has no counterpart to be written to.
Notes
- Algebraic, with no state: the output depends only on the current input.
- The cutoff is the STOPBAND edge. On Butterworth Design and Chebyshev Type I Design the port carries a passband edge; here it carries the frequency at which the response first reaches Rs. Feeding a Type II block the frequency you would have given a Type I puts the transition in the wrong place and nothing else goes wrong, which is why it is stated here rather than left to the name.
- b is not a scaled corner expansion. This is the one prototype in the family with finite zeros – they sit on the imaginary axis at ±i/cosθk and map onto the unit circle, so the digital numerator is palindromic and carries true nulls in the stopband. On the sibling blocks it is a constant times (z+1)N or (z−1)N.
- The clamp is a live branch, not a safety net. fc is clamped into (0, fs/2) by (|x−lo| − |x−hi| + lo + hi)/2, branchless and identical in this block and in all ten emitted bodies, so they agree bit for bit. It exists because VHDL's TAN raises an error at π/2, which stops a simulation rather than returning a bad number. A cutoff at or below zero therefore designs at the bottom of the band rather than failing: T → 0, the numerator collapses and the denominator becomes (z−1)N. The committed documentation sample shows it at fc = 0 – b down at ±9.4e−10, its own floor rather than zero because this numerator is a polynomial whose constant term survives, against a = [1, −3, 3, −1] to eight digits.
- An odd order has one fewer zero than pole. The angle at θ = π/2 has no finite zero, so the numerator's degree is N − 1 there and its leading entry after mapping is not the one a count of poles would predict.
- Measured against R2026a, at fs = 4 Hz over orders 1 to 8,
cutoffs 0.7 Hz and 1.1 Hz and both types: the largest disagreement with
cheby2on any coefficient is 1.2e−14 at order 8, and 6.7e−16 at order 3. - No state space: one scalar in and two vectors out, so there is no A/B/C/D to merge and model reduction correctly declines it.
Code facts#
| Fact | Value |
|---|---|
| registered type | Control_Systems/Polynomials/Chebyshev_Type_II_Design |
| family | Control_Systems/Polynomials |
| solver environment class | ICoreBlock_0_Control_Systems_1_Polynomials_2_Chebyshev_Type_II_Design |
| source | src/ICoreBlocks/ICoreBlockLibrary/Blocks/Control_Systems/Polynomials/Chebyshev_Type_II_Design/ICoreBlock_0_Control_Systems_1_Polynomials_2_Chebyshev_Type_II_Design.cpp |
| header | src/ICoreBlocks/ICoreBlockLibrary/Blocks/Control_Systems/Polynomials/Chebyshev_Type_II_Design/ICoreBlock_0_Control_Systems_1_Polynomials_2_Chebyshev_Type_II_Design.h |
| default size on canvas | 142 × 80 px |
| ports at insert | 1 in, 2 out |
| code generators implemented | Python, MATLAB, Java, Rust, C, C++, VHDL, Verilog, SystemVerilog, PLC Structured Text |
Ports#
| # | Direction | Signal type | Description label |
|---|---|---|---|
| 1 | in | ICoreDouble | fc |
| 2 | out | ICoreDouble | b |
| 3 | out | ICoreDouble | a |
Ports the constructor creates. A block whose port list changes with its configuration adds or removes ports at load time; the count above is the one a freshly inserted block has.
Configuration variables#
| Config variable | Default | Simulink parameter |
|---|---|---|
Order | 3 | — |
Filter Type | Lowpass%~%Highpass~~Lowpass | — |
Stopband Attenuation (dB) | 40 | — |
Sample Rate (Hz) | 100 | — |
Every block also carries Sampling Time (s) from ICoreBlockSolverEnvironment: zero or less inherits the solver's rate, a positive value runs the block at that period.
Simulink bridge#
| support | Support::None |
| Simulink path | — |
| port-count rule | PortsParam::None |
SampleTime parameter | yes |
Caveat (shown to the user): designing a Chebyshev Type II filter is a MATLAB function (cheby2), not a Simulink library block -- the two blocks that carry the design, Analog Filter Design and Lowpass IIR Filter Design in the DSP System Toolbox, take a signal in and give a filtered signal out, so neither exposes the coefficients this block emits and there is no path a diagram could name; the block is reported rather than dropped when a model crosses
Catalog contract: src/ICoreBlocks/ICoreCoder/ICoreCommandSystem/SimulinkBridge/ICoreSimulinkBlockCatalog.h
Description vs code#
The lists agree. check_block_descriptions.py finds no disagreement between the description's Ports, Parameters, Code export and Simulink bridge lists and the code's.
The verdict above is
tools/docs/check_block_descriptions.py(P7.1), which compares LISTS. It cannot read a sentence: "stateless" on a block with a state, an initial-value semantic the recursion does not implement, a "not synthesizable" caveat the HDL banner contradicts. That is the agent audit (P7.3) on BLOCK_DESCRIPTION_AUDIT.md, and this tool's green is not a substitute for one.
File banner (developer view)#
The top comment of the block's .cpp — the maths, the realization and the export strategy, addressed to whoever changes it. It must not contradict the description above (P7.5).
Chebyshev Type II Design -- cheby2 on a wire, with the stopband edge on a port The prototype is written down here; everything past it -- the prewarped bilinear map, the clamp on the cutoff, the normalization and all ten emitted bodies -- lives in ICoreFilterDesignSupport, shared with Chebyshev Type I Design and Bessel Design.
The analog prototype takes the stopband attenuation Rs in decibels and inverts the Type I construction:
eps = 1 / sqrt(10^(Rs/10) - 1) mu = asinh(1/eps) / N theta_k = pi(2k - 1) / (2N) poles the RECIPROCALS of -sinh(mu)sin(theta_k) +- i cosh(mu)cos(theta_k) zeros +- i / cos(theta_k)
A reciprocal pair is the real quadratic s^2 + (2a/r)s + 1/r with a = sinh(mu)sin(th), b = cosh(mu)cos(th) and r = a^2 + b^2; a zero pair is s^2 + 1/cos^2(th). An odd order adds the real pole at -1/sinh(mu) and NO zero, so the numerator's degree is N less N's parity. The gain puts the response at zero frequency at 1, which is where a Type II response is flat.
⚠ THE NUMERATOR IS A POLYNOMIAL, NOT A CONSTANT, and that is the whole reason the shared machinery accumulates the numerator with the same loop as the denominator instead of scaling a corner expansion. Padding it to N+1 entries is what makes the two formulas identical.
Verified against MATLAB R2026a rather than asserted, at fs = 4 Hz over orders 1 through 8, cutoffs 0.7 Hz and 1.1 Hz and both types: the largest disagreement with cheby2(N, 30, Wn) on any coefficient is 1.2e-14 at order 8, and 6.7e-16 at order 3. For the record, cheby2(3, 30, 0.35) reports
b 0.048358319089435602 0.016179568644232208 0.016179568644232249 0.048358319089435567 a 1 -1.8469207871592157 1.280587885000557 -0.3045913223740056
-- note the palindromic numerator: the imaginary-axis zeros map onto the unit circle.
Sample results#
| t | in ICoreDouble-Out-0 | out ICoreDouble-Out-0 [4x1] entry 0 | out ICoreDouble-Out-1 [4x1] entry 0 |
|---|---|---|---|
| 0 | -2 | [9.425e-10, -9.425e-10, -9.425e-10, 9.425e-10] | [1, -3, 3, -1] |
| 0.4 | 0.5 | [4.665e-4, -4.659e-4, -4.659e-4, 4.665e-4] | [1, -2.979, 2.958, -0.979] |
| 0.8 | -2 | [9.425e-10, -9.425e-10, -9.425e-10, 9.425e-10] | [1, -3, 3, -1] |
| 1.2 | 0.5 | [4.665e-4, -4.659e-4, -4.659e-4, 4.665e-4] | [1, -2.979, 2.958, -0.979] |
| 1.6 | -2 | [9.425e-10, -9.425e-10, -9.425e-10, 9.425e-10] | [1, -3, 3, -1] |
| 2 | 0.5 | [4.665e-4, -4.659e-4, -4.659e-4, 4.665e-4] | [1, -2.979, 2.958, -0.979] |
| 2.4 | -2 | [9.425e-10, -9.425e-10, -9.425e-10, 9.425e-10] | [1, -3, 3, -1] |
| 2.8 | 0.5 | [4.665e-4, -4.659e-4, -4.659e-4, 4.665e-4] | [1, -2.979, 2.958, -0.979] |
| 3.2 | -2 | [9.425e-10, -9.425e-10, -9.425e-10, 9.425e-10] | [1, -3, 3, -1] |
| 3.6 | 0.5 | [4.665e-4, -4.659e-4, -4.659e-4, 4.665e-4] | [1, -2.979, 2.958, -0.979] |
| 4 | -2 | [9.425e-10, -9.425e-10, -9.425e-10, 9.425e-10] | [1, -3, 3, -1] |
| 4.4 | 0.5 | [4.665e-4, -4.659e-4, -4.659e-4, 4.665e-4] | [1, -2.979, 2.958, -0.979] |
| 4.8 | -2 | [9.425e-10, -9.425e-10, -9.425e-10, 9.425e-10] | [1, -3, 3, -1] |
| 5.2 | 0.5 | [4.665e-4, -4.659e-4, -4.659e-4, 4.665e-4] | [1, -2.979, 2.958, -0.979] |
Every 4th of 60 samples, from the table stimulus.
The same rig also ran:
| Stimulus | What it is | Output range |
|---|---|---|
impulse | Impulse: one sample of 1 at k = 5, 0 elsewhere (Repeating Sequence Stair) | 9.425e-10 … 9.243e-4 |
ramp | Ramp: slope 1 from t = 0 | 9.425e-10 … 0.005103 |
sine | Sine Wave: amplitude 1, 2 rad/s, no phase, no bias | 9.425e-10 … 9.239e-4 |
step | Step: 0 -> 1 at t = 1 s | 9.425e-10 … 9.243e-4 |
Plotted: table — Repeating Sequence Stair: [-2 -1 -0.5 0 0.5 1 2 3], one entry per sample
Category static · sample time 0.1 · 60 steps · commit 6d2a32943e8a43f61031df0ab843ecb40e59b166 · produced by docsSample --out <folder> --blocks Chebyshev_Type_I_Design Chebyshev_Type_II_Design Bessel_Design --steps 60 · data docs/generated/samples/Control_Systems__Polynomials__Chebyshev_Type_II_Design.json · the SVG is generated from those numbers by tools/docs/plot_svg.py, so it is a run and not a drawing (R-D10).