Specialist Department: MATLAB & Simulation. Activated when project involves .m/.mlx/.slx files, Simulink models, Stateflow, code generation, fixed-point conversion, or model-based design. Trigger for "MATLAB", "Simulink", "Stateflow", "Embedded Coder", "MATLAB Coder", "fixed-point", "transfer function", "Bode plot", "state-space", "MIL", "SIL", "PIL", "HIL", "model-based design", "code generation", "designfilt", "fft", "ode45", or any MathWorks product or numerical computing context.
Activates when ANY of: .m, .mlx, .slx, .mdl files detected; MATLAB path setup (startup.m, pathdef.m); toolbox usage; Simulink blocks; Stateflow charts; Embedded Coder configuration; or user explicitly states MATLAB context.
Additional NFR categories to capture:
Additional design concerns:
+pkgname/ packages to avoid name collisions.velocity_mps, temperature_degC, pressure_kPa, angle_rad.
Every signal name includes unit suffix.maxTorque_Nm, filterOrder, sampleRate_Hz. Include unit.MATLAB coding standards:
arguments block (R2019b+) for type
and range validation on all public functions.
function [output] = calculateTrajectory(pos, vel, dt, options)
%CALCULATETRAJECTORY Compute projectile trajectory with drag.
% [POS] = CALCULATETRAJECTORY(P0, V0, DT) computes trajectory...
arguments
pos (3,1) double
vel (3,1) double
dt (1,1) double {mustBePositive}
options.dragCoeff (1,1) double {mustBeNonnegative} = 0.47
end
arrayfun, bsxfun.
Document when loops are intentional (memory, algorithm requirement).result = zeros(n, m) before loops. NEVER grow arrays in loops.if (a == b). ALWAYS if abs(a-b) < tol.\ not inv(): x = A \ b is numerically stable. x = inv(A) * b is not.
Check condition: if cond(A) > 1e12, warning('Ill-conditioned'); end.... 4-space indent. One statement per line.%% Section Name to organize scripts.MATLAB testing standards:
matlab.unittest.TestCase with method-based tests.% Validates FR-001, AC-001-1 comment on every test.testCase.verifyEqual(actual, expected, 'AbsTol', 1e-10) or
'RelTol', 1e-6. NEVER use exact equality for floating-point.timeit(@() functionToTest(args)) to validate NFR timing budgets.CodeCoveragePlugin for coverage reporting.[], {}, empty strings.sltest.TestCase for model testing. Equivalence testing for
MIL vs SIL, SIL vs PIL. Use test harness for each subsystem.eval, evalc, evalin, feval(string) — injection risk.system() or ! command with user-supplied strings.fopen, load, save.matfile or datastore for large data (not load into workspace).Additional release artifacts:
matlab.codetools.requiredFilesAndProducts output.| Toolbox | Use Case |
|---|---|
| Signal Processing | Filtering, FFT, spectral analysis |
| Control System | Transfer functions, Bode, root locus |
| Image Processing | Filtering, segmentation, feature extraction |
| Statistics & Machine Learning | Regression, classification, clustering |
| Optimization | Linear/nonlinear solvers, genetic algorithms |
| Symbolic Math | Analytical solutions, symbolic derivation |
| Simulink | Dynamic system modeling and simulation |
| Stateflow | State machines, sequential logic |
| Embedded Coder | Production C/C++ code generation |
| MATLAB Coder | General-purpose C/C++ code generation |
| Simulink Test | Test harness management, equivalence testing |
| Fixed-Point Designer | Fixed-point conversion and optimization |
| DSP System | Streaming signal processing |
| Communications | Modulation, coding, channel models |
| Aerospace | Flight dynamics, coordinate transforms |
| Robotics System | Kinematics, path planning, ROS interface |
| Automated Driving | Perception, planning, vehicle dynamics |
| Sensor Fusion & Tracking | Kalman filters, multi-object tracking |
| Deep Learning | Neural networks, training, inference |
| Computer Vision | Feature detection, object recognition |
| Radar | Waveform design, target detection |
references/numerical-computing.md — Float pitfalls, FFT patterns, filter design, control
systems, fixed-point notation, common error fixes.