matlab-apply-assignmen…
Use when a learner asks for help with MATLAB homework, labs, projects, graded assignments, take-home exams, quizzes, or any programming task where academic…
Generate correct MATLAB code using the Symbolic Math Toolbox. Use when the user asks for symbolic computations, analytical solutions, symbolic differentiation/integration, equation solving, or converting symbolic results to numeric MATLAB functions. Also use when converting
$ npx -y skills add matlab/agent-skills-playground --skill matlab-symbolic-math --agent claude-codeHow it fires
How this skill gets triggered: by you, by Claude, or both.
/matlab-symbolic-mathContext preview
The summary Claude sees to decide when to auto-load this skill.
Generate correct MATLAB code using the Symbolic Math Toolbox. Use when the user asks for symbolic computations, analytical solutions, symbolic differentiation/integration, equation solving, or converting symbolic results to numeric MATLAB functions. Also use when converting
name: matlab-symbolic-math description: Generate correct MATLAB code using the Symbolic Math Toolbox. Use when the user asks for symbolic computations, analytical solutions, symbolic differentiation/integration, equation solving, or converting symbolic results to numeric MATLAB functions. Also use when converting differential equations to transfer functions or state-space form. license: https://www.mathworks.com/content/dam/mathworks/license/pmrl/license.md metadata: author: MathWorks version: "1.0"
This skill provides guidelines, correct syntax, and common patterns for generating MATLAB® code that uses Symbolic Math Toolbox.
**WRONG (deprecated — warns today, errors in a future release; the single `=` in `solve` errors now):**
solve('x^2 + 2*x - 3 = 0')
dsolve('Dy = -a*y')**CORRECT:**
syms x solve(x^2 + 2*x - 3 == 0, x) syms y(t) a dsolve(diff(y,t) == -a*y)
**WRONG:**
% Inside a function:
function result = myFunc()
syms x % Error or unreliable in compiled/nested functions
result = x^2;
end
% Creating symbolic constant pi:
p = sym('pi'); % Creates variable named "pi", NOT the constant**CORRECT:**
% Inside a function:
function result = myFunc()
x = sym('x'); % Use sym inside functions
result = x^2;
end
% Creating symbolic constant pi:
p = sym(pi); % Converts numeric pi to exact symbolic πAssumptions persist in the symbolic engine even after `clear`. This is a frequent source of subtle bugs.
% Setting assumptions
syms x real % x is real (clears prior assumptions)
syms n positive integer % n is a positive integer
assume(x > 0) % x is positive (REPLACES all prior assumptions on x)
assumeAlso(x < 10) % ADDS assumption: 0 < x < 10
% Checking assumptions
assumptions(x) % Shows assumptions on x
assumptions % Shows ALL assumptions in workspace
% Clearing assumptions — THREE ways (know the differences):
syms x % Recreate with syms: clears assumptions
assume(x, 'clear') % Explicitly clear assumptions on x
reset(symengine) % Nuclear option: clears EVERYTHING
% DANGER: clear x does NOT clear assumptions!
clear x % Removes variable from workspace
x = sym('x'); % x INHERITS old assumptions from engine!**Best Practice:** Use `syms` to create variables at the start of a script. This clears stale assumptions. Use `assume(x, 'clear')` when you need to reset a specific variable mid-script.
The `subs` function returns a new expression. It does NOT modify the original.
**WRONG:**
syms x f = x^2 + 3*x; subs(f, x, 2); % Result is discarded! disp(f) % Still x^2 + 3*x
**CORRECT:**
syms x f = x^2 + 3*x; f_val = subs(f, x, 2); % Assign the result % or: f = subs(f, x, 2); % Overwrite f
AI tools frequently over-wrap every numeric literal in `sym()`. When any operand in an arithmetic expression is symbolic, MATLAB automatically promotes all numeric literals in that expression to symbolic. Wrapping literals in `sym()` adds clutter and can cause errors. **When you DO need `sym()`:** Only when creating a standalone symbolic number with NO symbolic variables present in the expression.
% No symbolic variable involved — sym() IS needed: half = sym(1/2); % Exact 1/2, not 0.5 double half = sym(1)/2; % Exact 1/2, declaring sym(1) promotes all numeric literals to symbolic piExact = sym(pi); % Exact π, not 3.14159... % Symbolic variable already present — sym() is NOT needed: syms x f = x/2 + 1/3; % Automatically exact: x/2 + 1/3 g = exp(-x^2/2) / sqrt(2*pi); % All literals promoted by x
When substituting numeric values or converting symbolic expressions to numeric form, keep the base variable name and append a suffix indicating the conversion type:
syms m g L % Substituting numeric values mVal = double(subs(m, 5)); % or: mVal = 5; gVal = 9.81; LVal = 0.5; % Evaluating a symbolic expression numerically omega = sqrt(g/L); omegaVal = double(subs(omega, [g L], [gVal LVal])); % Variable-precision arithmetic piVpa = vpa(sym(pi), 50); omegaVpa = vpa(subs(omega, [g L
A sandbox for prototyping and demonstrating Agent Skills for MATLAB and Simulink work. Skills here are experimental. They may be incomplete, change without notice, or migrate to an official toolkit over time.
Repo: matlab/agent-skills-playground
Use when a learner asks for help with MATLAB homework, labs, projects, graded assignments, take-home exams, quizzes, or any programming task where academic…
Use when tutoring a learner through MATLAB debugging, error interpretation, failed tests, incorrect outputs, array-shape problems, indexing mistakes, function…
Use when an AI tutor session concerns MATLAB programming concepts, MATLAB syntax, MATLAB errors, MATLAB code style, MATLAB projects, or MATLAB toolbox…
Use when an instructor wants to create, interview for, configure, install, update, or review a course AI-use policy for MATLAB AI tutoring. Produces an…
Use when prompting a learner to complete hands-on MATLAB coding exercises, guided practice, debugging drills, code tracing, small MATLAB projects, or…
Use when creating, asking, grading, or explaining multiple choice questions for MATLAB programming practice, concept checks, quizzes, or tutoring exercises.