Skip to content
Development
Skill

/matlab-scientific-computing

MATLAB/GNU Octave numerical computing: matrices, linear algebra, ODEs, signal processing, optimization, statistics, scientific visualization. MATLAB-syntax examples run on both. For Python use numpy/scipy; for statistical modeling use statsmodels.

From plugin
sciagent-skills
364200 skills
Install
$ npx -y skills add jaechang-hits/SciAgent-Skills --skill matlab-scientific-computing --agent claude-code

How it fires

How this skill gets triggered: by you, by Claude, or both.

  • Fires itselfAuto-invocation. Claude auto-loads it when your prompt matches the work.Auto-invocation is when the right skill fires by itself at the right moment, driven by a FLOW.md router and a hook, instead of you invoking it by name. It is the difference between a skill being installed and a skill actually getting used.Read the full definition →
  • You can call itInvoke it directly when you want it.
  • Slash command/matlab-scientific-computing

Context preview

The summary Claude sees to decide when to auto-load this skill.

MATLAB/GNU Octave numerical computing: matrices, linear algebra, ODEs, signal processing, optimization, statistics, scientific visualization. MATLAB-syntax examples run on both. For Python use numpy/scipy; for statistical modeling use statsmodels.

SKILL.md

matlab-scientific-computing.SKILL.md
name: matlab-scientific-computing
description: "MATLAB/GNU Octave numerical computing: matrices, linear algebra, ODEs, signal processing, optimization, statistics, scientific visualization. MATLAB-syntax examples run on both. For Python use numpy/scipy; for statistical modeling use statsmodels."
license: "GPL-3.0 (GNU Octave); MATLAB requires commercial license"

MATLAB/Octave — Scientific Computing

Overview

MATLAB is a numerical computing environment optimized for matrix operations and scientific computing. GNU Octave is a free, open-source alternative with high compatibility. All code examples use MATLAB syntax that runs on both platforms.

When to Use

  • Performing matrix operations and linear algebra (eigenvalues, SVD, least squares)
  • Solving ordinary and partial differential equations numerically
  • Signal processing (FFT, filtering, spectral analysis)
  • Creating 2D/3D scientific visualizations and publication figures
  • Numerical optimization and root finding
  • Statistical analysis and curve fitting
  • Batch processing of experimental data files
  • For **Python-based numerical computing**, use numpy/scipy instead
  • For **statistical modeling with inference**, use statsmodels instead

Prerequisites

# GNU Octave (free, open-source)
# macOS
brew install octave
# Ubuntu/Debian
sudo apt install octave

# Running scripts
octave script.m                           # Octave
matlab -nodisplay -nosplash -r "run('script.m'); exit;"  # MATLAB

**Note**: MATLAB requires a commercial license from MathWorks. GNU Octave is free and runs most MATLAB scripts without modification. Key Octave differences: supports `#` comments, `++`/`+=` operators; some MATLAB toolbox functions unavailable.

Quick Start

% Load data, fit, and plot
x = linspace(0, 2*pi, 100);
y = sin(x) + 0.1 * randn(size(x));
p = polyfit(x, y, 5);
y_fit = polyval(p, x);

figure;
plot(x, y, 'bo', x, y_fit, 'r-', 'LineWidth', 2);
xlabel('x'); ylabel('y');
legend('Data', 'Polynomial fit');
title('Curve Fitting Example');
saveas(gcf, 'fit_result.png');

Core API

1. Matrix Operations

MATLAB operates fundamentally on matrices and arrays.

% Create matrices
A = [1 2 3; 4 5 6; 7 8 9];    % 3x3 matrix
v = linspace(0, 1, 100);       % 100 evenly spaced points
I = eye(3);                     % Identity matrix
R = rand(3, 3);                 % Uniform random
N = randn(3, 3);                % Normal random

% Operations
B = A';                  % Transpose
C = A * B;               % Matrix multiplication
D = A .* B;              % Element-wise multiplication
x = A \ [1; 2; 3];      % Solve Ax = b (preferred over inv(A)*b)
fprintf('Solution: [%.2f, %.2f, %.2f]\n', x);
% Indexing and manipulation
A = magic(5);
sub = A(1:3, 2:4);      % Submatrix (rows 1-3, cols 2-4)
row = A(2, :);           % Entire row 2
col = A(:, 3);           % Entire column 3
A(A < 5) = 0;           % Logical indexing

% Concatenation
C = [A; ones(1, 5)];    % Vertical (add row)
D = [A, zeros(5, 1)];   % Horizontal (add column)
fprintf('Size: %d x %d\n', size(C));

2. Linear Algebra

A = [4 1 2; 1 3 1; 2 1 5];

% Eigendecomposition
[V, D] = eig(A);           % V: eigenvectors, D: diagonal eigenvalues
fprintf('Eigenvalues: %.2f, %.2f, %.2f\n', diag(D));

% Singular value decomposition
[U, S, V] = svd(A);
fprintf('Singular values: %.2f, %.2f, %.2f\n', diag(S));

% Matrix decompositions
[L, U, P] = lu(A);         % LU with pivoting
[Q, R] = qr(A);            % QR decomposition
R_chol = chol(A);           % Cholesky (symmetric positive definite)

% Condition number and rank
fprintf('Condition number: %.2f\n', cond(A));
fprintf('Rank: %d\n', rank(A));

3. Plotting and Visualization

% 2D line plots
x = 0:0.1:2*pi;
figure;
plot(x, sin(x), 'b-', 'LineWidth', 2); hold on;
plot(x, cos(x), 'r--', 'LineWidth', 2);
xlabel('x'); ylabel('y');
title('Trigonometric Functions');
legend('sin(x)', 'cos(x)');
grid on;
saveas(gcf, 'trig.png');
% 3D surface plot
[X, Y] = meshgrid(-2:0.1:2, -2:0.1:2);
Z = X.^2 + Y.^2;
figure;
surf(X, Y, Z);
colorbar; xlabel('X'); ylabel('Y'); zlabel('Z');
title('Paraboloid');
print('-dpdf', 'surface.pdf');
% Multi-panel figure
figure;
subplot(2, 2, 1); plot(x, sin(x)); title('sin');
subplot(2, 2, 2); plot(x, cos(x)); title('cos');
subplot(2, 2, 3); bar([1 3 2 5 4]); title('Bar');
subplot(2, 2, 4); histogram(randn(1000, 1), 30); title('Histogram');
saveas(gcf, 'panels.png');

4. Data Import/Export

% CSV / tabular data
T = readtable('data.csv');
M = readmatrix('data.csv');
fprintf('Table: %d rows x %d cols\n', height(T), width(T));

% Write data
writetable(T, 'output.csv');
writematrix(M, 'output.csv');

% MAT files (MATLAB native binary)
A = rand(100, 100);
save('data.mat', 'A');          % Save variable
S = load('data.mat', 'A');     % Load specific variable

% Images
img = imread('image.png');
fprintf('Image size: %d x %d x %d\n', size(img));
imwrite(img, 'output.jpg');

5. Statistics and Data Analysis

data = randn(1000, 1) * 5 + 50;

% Descriptive statistics
fprintf('Mean: %.2f, Std: %.2f, Median: %.2f\n', mean(data), std(data), median(data));
fprintf('Min: %.2f, Max: %.2f\n', min(data), max(data));

% Correlation and covariance
X = randn(100, 3);
R = corrcoef(X);
fprintf('Correlation matrix:\n');
disp(R);

% Linear regression (polyfit)
x = (1:50)';
y = 2.5 * x + 10 + randn(50, 1) * 5;
p = polyfit(x, y, 1);
fprintf('Slope: %.2f, Intercept: %.2f\n', p(1), p(2));

% Moving statistics
y_smooth = movmean(y, 5);

6. Differential Equations

% First-order ODE: dy/dt = -2y, y(0) = 1
f = @(t, y) -2 * y;
[t, y] = ode45(f, [0 5], 1);
figure; plot(t, y, 'b-', 'LineWidth', 2);
xlabel('Time'); ylabel('y(t)');
title('Exponential Decay');
fprintf('Final value: %.4f (expected: %.4f)\n', y(end), exp(-10));
% Second-order ODE: y'' + 0.5y' + 4y = 0 (damped oscillator)
%
Read more
Ships withsciagent-skills

Turn your AI coding agent into a life sciences expert — 199 bioinformatics skills for Claude Code covering RNA-seq, single-cell analysis, genomics, proteomics, drug discovery, and more. Boosted BixBench from 65% to 92%. Open source.

Get the whole plugin

Other skills on sciagent-skills.