matlab
できること
このスキルは、数値計算のためのMATLABとOctaveのコードを書き、直す方法をエージェントに教えます。行列の演算、データ分析、科学的なグラフを扱います。
使う場面
- ✓線形代数や信号処理のためのMATLABまたはOctaveのスクリプトが必要なとき。
- ✓MATLABの構文や特定の関数について手助けがほしいとき。
- ✓MATLABとOctaveの間でコードを変換したいとき。
スキルのリンク
https://github.com/zLanqing/codex-claude-academic-skills/blob/main/scientific-toolkit-skill/references/scientific-skills/matlab/SKILL.mdコピーしてAI(Claude、ChatGPT、Cursor)に貼り付け、指示に従うよう頼んでください。
使い方
いちばん簡単な方法:メッセージをコピーしてAIに貼り付けるだけ。AIがスキルを読んで指示に従います。
貼り付け用メッセージ
Claude Code、Codex、Cursorの場合:プロジェクトのフォルダで実行するとスキルがインストールされます。
SKILL.mdをダウンロードして、エージェントのスキル用フォルダに入れてください。
AIへの頼み方の例
“連立方程式を解いて、結果をグラフにするMATLABのスクリプトを書いてもらえますか?”
毎週5つの新しいスキル。1分で読めます。
仕組み
エージェントは、MATLABまたはOctaveの構文と組み込み関数を使って、スクリプトを書き、実行し、直します。スクリプトは、matlabまたはoctaveコマンドでターミナルから実行できます。
技術的な内容(元のSKILL.md)
作者による元のテキスト(英語)をGitHubからそのまま表示しています。
MATLAB/Octave Scientific Computing
MATLAB is a numerical computing environment optimized for matrix operations and scientific computing. GNU Octave is a free, open-source alternative with high MATLAB compatibility.
Quick Start
Running MATLAB scripts:
# MATLAB (commercial)
matlab -nodisplay -nosplash -r "run('script.m'); exit;"
# GNU Octave (free, open-source)
octave script.m
Install GNU Octave:
# macOS
brew install octave
# Ubuntu/Debian
sudo apt install octave
# Windows - download from https://octave.org/download
Core Capabilities
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 = 1:10; % Row vector 1 to 10
v = linspace(0, 1, 100); % 100 points from 0 to 1
% Special matrices
I = eye(3); % Identity matrix
Z = zeros(3, 4); % 3x4 zero matrix
O = ones(2, 3); % 2x3 ones matrix
R = rand(3, 3); % Random uniform
N = randn(3, 3); % Random normal
% Matrix operations
B = A'; % Transpose
C = A * B; % Matrix multiplication
D = A .* B; % Element-wise multiplication
E = A \ b; % Solve linear system Ax = b
F = inv(A); % Matrix inverse
For complete matrix operations, see references/matrices-arrays.md.
2. Linear Algebra
% Eigenvalues and eigenvectors
[V, D] = eig(A); % V: eigenvectors, D: diagonal eigenvalues
% Singular value decomposition
[U, S, V] = svd(A);
% Matrix decompositions
[L, U] = lu(A); % LU decomposition
[Q, R] = qr(A); % QR decomposition
R = chol(A); % Cholesky (symmetric positive definite)
% Solve linear systems
x = A \ b; % Preferred method
x = linsolve(A, b); % With options
x = inv(A) * b; % Less efficient
For comprehensive linear algebra, see references/mathematics.md.
3. Plotting and Visualization
% 2D Plots
x = 0:0.1:2*pi;
y = sin(x);
plot(x, y, 'b-', 'LineWidth', 2);
xlabel('x'); ylabel('sin(x)');
title('Sine Wave');
grid on;
% Multiple plots
hold on;
plot(x, cos(x), 'r--');
legend('sin', 'cos');
hold off;
% 3D Surface
[X, Y] = meshgrid(-2:0.1:2, -2:0.1:2);
Z = X.^2 + Y.^2;
surf(X, Y, Z);
colorbar;
% Save figures
saveas(gcf, 'plot.png');
print('-dpdf', 'plot.pdf');
For complete visualization guide, see references/graphics-visualization.md.
4. Data Import/Export
% Read tabular data
T = readtable('data.csv');
M = readmatrix('data.csv');
% Write data
writetable(T, 'output.csv');
writematrix(M, 'output.csv');
% MAT files (MATLAB native)
save('data.mat', 'A', 'B', 'C'); % Save variables
load('data.mat'); % Load all
S = load('data.mat', 'A'); % Load specific
% Images
img = imread('image.png');
imwrite(img, 'output.jpg');
For complete I/O guide, see references/data-import-export.md.
5. Control Flow and Functions
% Conditionals
if x > 0
disp('positive');
elseif x < 0
disp('negative');
else
disp('zero');
end
% Loops
for i = 1:10
disp(i);
end
while x > 0
x = x - 1;
end
% Functions (in separate .m file or same file)
function y = myfunction(x, n)
y = x.^n;
end
% Anonymous functions
f = @(x) x.^2 + 2*x + 1;
result = f(5); % 36
For complete programming guide, see references/programming.md.
6. Statistics and Data Analysis
% Descriptive statistics
m = mean(data);
s = std(data);
v = var(data);
med = median(data);
[minVal, minIdx] = min(data);
[maxVal, maxIdx] = max(data);
% Correlation
R = corrcoef(X, Y);
C = cov(X, Y);
% Linear regression
p = polyfit(x, y, 1); % Linear fit
y_fit = polyval(p, x);
% Moving statistics
y_smooth = movmean(y, 5); % 5-point moving average
For statistics reference, see references/mathematics.md.
7. Differential Equations
% ODE solving
% dy/dt = -2y, y(0) = 1
f = @(t, y) -2*y;
[t, y] = ode45(f, [0 5], 1);
plot(t, y);
% Higher-order: y'' + 2y' + y = 0
% Convert to system: y1' = y2, y2' = -2*y2 - y1
f = @(t, y) [y(2); -2*y(2) - y(1)];
[t, y] = ode45(f, [0 10], [1; 0]);
For ODE solvers guide, see references/mathematics.md.
8. Signal Processing
% FFT
Y = fft(signal);
f = (0:length(Y)-
よくある質問
MATLABを買わずに実行できますか?
はい。GNU Octaveは、互換性の高い無料のオープンソースの代替だと、スキルは説明しています。
コマンドラインからスクリプトを実行するには?
スキルが示すとおり、matlabまたはoctaveコマンドにスクリプト名を渡します。
グラフ作成も対象ですか?
はい。科学的な可視化の作成も扱います。
詳細
作者による元の説明
MATLAB and GNU Octave numerical computing for matrix operations, data analysis, visualization, and scientific computing. Use when writing MATLAB/Octave scripts for linear algebra, signal processing, image processing, differential equations, optimization, statistics, or creating scientific visualizations. Also use when the user needs help with MATLAB syntax, functions, or wants to convert between MATLAB and Python code. Scripts can be executed with MATLAB or the open-source GNU Octave interpreter.
人気
- GitHubのスター
- 5.6k
- ランキング
- #14767
- ライセンス
- MIT
- 更新日
- 2026/5/14
コメント
- …
このリポジトリの他のスキル
office-academic-skill
5.6kエージェントが、研究論文をWordの報告書に変え、中国語を基本として編集可能な学術用のPowerPointのスライドを作れるよう支援します。スピーカーノートとレイアウトの確認も含みます。
research-writing-skill
5.6kエージェントが、研究論文のセクション、要旨、査読者への回答を書き、直し、磨けるよう支援します。数式、題名、引用は与えられた通りに保ちます。
scientific-toolkit-skill
5.6kエージェントが、信号と画像の処理、統計、シミュレーション、出版に使える図のために、MATLABやPythonの科学計算のコードを書き、デバッグできるよう支援します。
matplotlib
5.6kエージェントが、matplotlibでPythonのカスタムのグラフを作り、グラフのすべての要素を制御して、論文向けのPNG、PDF、SVGのファイルとして書き出せるよう支援します。
似ているスキル
gitcrawl
394k保存されたGitHubのイシューとプルリクエストのアーカイブを検索し、重複をまとめ、GitHub上の現在の状態を確認するようエージェントを支援します。
slacrawl
394kローカルのSlackアーカイブ内のメッセージを検索して件数を数え、アーカイブの新しさを確認し、必要に応じて更新するようエージェントを支援します。
goplaces
394kGoogle Placesを使って、場所を検索し、詳細や口コミを取得し、場所の名前を解決するようエージェントを支援します。スクリプト用にJSON出力もできます。