Skip to content

matlab/matlab-agentic-toolkit / skills-catalog/computational-biology/simbiology-build-model

simbiology-build-model

Unverified

Build, modify, and diagram SimBiology models — API reference, helper functions, and layout patterns. Use when constructing or editing models programmatically or visually.

references/pk-library-guidance.md

View on GitHub
# Standard PK Models with PKModelDesign

Use `PKModelDesign` when the user asks for a standard PK model (1- or
2-compartment with common dosing and elimination). This produces models
consistent with SimBiology's PK library — correct parameterization,
naming conventions, and rules.

Use manual construction (`addcompartment`/`addspecies`/`addreaction`)
for custom mechanisms (receptor-ligand, QSP, gene circuits, PBPK, etc.).

---

## When to Use PKModelDesign

- "Create a one-compartment PK model"
- "Build a 2-compartment model with first-order absorption"
- "Make a PK model with bolus dosing and linear clearance"
- Any request that maps directly to a standard compartmental PK structure

## Basic Pattern

```matlab
pkmd = PKModelDesign;
pkmd.addCompartment('Central', ...
    'DosingType', 'Bolus', ...
    'EliminationType', 'Linear-Clearance', ...
    'HasResponseVariable', true);
[model, modelMap] = pkmd.construct;
```

## Options

### DosingType

| Value | Effect | Dosed species |
|-------|--------|---------------|
| `'Bolus'` | Direct dose into central | `Drug_Central` |
| `'FirstOrder'` | Absorption from depot (ka) | `Dose_Central` |
| `'ZeroOrder'` | Zero-order input (duration Tk0) | `Drug_Central` |
| `'Infusion'` | IV infusion | `Drug_Central` |
| `''` | No dosing in this compartment | — |

### EliminationType

| Value | Parameters | Kinetics |
|-------|-----------|----------|
| `'Linear-Clearance'` | `Cl_Central`, `ke_Central` | MassAction; rule: `ke_Central = Cl_Central / Central` |
| `'Linear'` | `ke_Central` | MassAction (micro-constant only) |
| `'Enzymatic'` | `Vm_Central`, `Km_Central` | Henri-Michaelis-Menten |
| `''` | — | No elimination in this compartment |

### Other options

| Option | Effect |
|--------|--------|
| `'HasResponseVariable', true` | Marks drug concentration as observed output |
| `'HasLag', true` | Adds `TLag_Central` lag-time parameter |

## Common Models

### 1-compartment, bolus, linear clearance

```matlab
pkmd = PKModelDesign;
pkmd.addCompartment('Central', 'DosingType', 'Bolus', ...
    'EliminationType', 'Linear-Clearance', 'HasResponseVariable', true);
[model, modelMap] = pkmd.construct;
```

Produces:
- Species: `Dose_Central`, `Drug_Central`
- Parameters: `ka_Central`, `Cl_Central`, `ke_Central`
- Reactions: `Dose_Central -> Drug_Central` (MassAction), `Drug_Central -> null` (MassAction)
- Rules: `ke_Central = Cl_Central / Central`
- Dose target: `Drug_Central`

### 1-compartment, first-order absorption, linear clearance

```matlab
pkmd = PKModelDesign;
pkmd.addCompartment('Central', 'DosingType', 'FirstOrder', ...
    'EliminationType', 'Linear-Clearance', 'HasResponseVariable', true);
[model, modelMap] = pkmd.construct;
```

Same as above but dose target is `Dose_Central` (absorption compartment).
Absorption rate `ka_Central` drives `Dose_Central -> Drug_Central`.

### 2-compartment, bolus, linear clearance

```matlab
pkmd = PKModelDesign;
pkmd.addCompartment('Central', 'DosingType', 'Bolus', ...
    'EliminationType', 'Linear-Clearance', 'HasResponseVariable', true);
pkmd.addCompartment('Peripheral');
[model, modelMap] = pkmd.construct;
```

Adds:
- Species: `Dose_Peripheral`, `Drug_Peripheral`
- Parameters: `Q12`, `k12`, `k21`
- Reactions: `Central.Drug_Central <-> Peripheral.Drug_Peripheral`
- Rules: `k12 = Q12 / Central`, `k21 = Q12 / Peripheral`

### 1-compartment, bolus, Michaelis-Menten elimination

```matlab
pkmd = PKModelDesign;
pkmd.addCompartment('Central', 'DosingType', 'Bolus', ...
    'EliminationType', 'Enzymatic', 'HasResponseVariable', true);
[model, modelMap] = pkmd.construct;
```

Produces:
- Parameters: `Vm_Central`, `Km_Central`
- Elimination reaction uses `Henri-Michaelis-Menten` kinetic law

## modelMap Output

`pkmd.construct` returns a `PKModelMap` with fitting-relevant info:

| Field | Content |
|-------|---------|
| `Dosed` | Cell array of species that receive doses |
| `DosingType` | Cell array of dosing mechanisms |
| `Estimated` | Cell array of parameters/compartments to estimate |
| `Observed` | Cell array of response species |
| `ZeroOrderDurationParameter` | Duration param for zero-order dosing |
| `LagParameter` | Lag-time parameter names |

## Naming Conventions

`PKModelDesign` uses consistent naming that differs from ad-hoc models:

| Element | PK Library Name | Common ad-hoc names (avoid) |
|---------|----------------|----------------------------|
| Drug species | `Drug_Central` | `Drug`, `Cp`, `C` |
| Absorption species | `Dose_Central` | `Depot`, `GI`, `Gut` |
| Clearance | `Cl_Central` | `CL`, `Cl` |
| Elimination rate | `ke_Central` | `ke`, `kel`, `k_el` |
| Absorption rate | `ka_Central` | `ka`, `k_abs` |
| Inter-compartmental clearance | `Q12` | `Q`, `CLD` |
| Transfer rates | `k12`, `k21` | `kcp`, `kpc` |
| Volume | Compartment `Value` (`Central`) | `Vd`, `V1`, `Vc` |

## Post-Construction Customization

After `construct`, modify the model as needed:

```matlab
[model, modelMap] = pkmd.construct;

% Rename model
model.Name = 'PK_1comp_BolusIV';

% Set parameter values
p = sbioselect(model, 'Type', 'parameter', 'Name', 'Cl_Central');
p.Value = 5;  % L/hr

% Set compartment volume
comp = model.Compartments(1);
comp.Value = 50;  % L

% Add units
p.Units = 'liter/hour';
comp.Units = 'liter';
```


----

Copyright 2026 The MathWorks, Inc.

----
rea-changelog-updatemorluto/reaPrepare or rewrite REA release changelogs and GitHub release notes from pinned Git history, with verified contributor thanks and Release Please synchronization.Stars: 472kUpdated Claude CodeCodexVerifiedInstall
academy-guideanthropics/skillsStop and check this skill before finishing any reply to a question about how to use Claude or a Claude product — it recommends matching courses, tutorials, and use cases from Claude Academy (academy.claude.com), Anthropic's learning hub. Trigger on: "how do I", "how can I", "getting started with", "what can Claude do", "teach me", "learn to use"; questions about artifacts, projects, skills, plugins, connectors, MCP; requests about rolling Claude out to a team, class, or organization; and any ask for training materials, onboarding content, or learning resources. Use it when the user is learning how to use a feature or product — not when they are mid-task and just want the task done. This skill composes with other skills: after consulting product documentation to answer how a Claude feature works, also check here for a matching course or tutorial — a docs-grounded answer and an Academy recommendation belong together. Only recommend on a strong match; never invent Academy content.Stars: 198kUpdated Claude CodeCodexVerifiedInstall
claude-apianthropics/skillsReference for the Claude API / Anthropic SDK — model ids, pricing, params, streaming, tool use, MCP, agents, caching, token counting, model migration. TRIGGER — read BEFORE opening the target file; don't skip because it "looks like a one-liner" — whenever: the prompt names Claude/Anthropic in any form (Claude, Anthropic, Fable, Opus, Sonnet, Haiku, `anthropic`, `@anthropic-ai`, `claude-*`, `us.anthropic.*`, `[1m]`); the user asks about an LLM (pricing/model choice/limits/caching) — never answer from memory; OR the task is LLM-shaped with provider unstated (agent/MCP/tool-definition/multi-agent/RAG/LLM-judge/computer-use; generate/summarize/extract/classify/rewrite/converse over NL; debugging refusals/cutoffs/streaming/tool-calls/tokens). SKIP only when another provider is being worked on (overrides all triggers): OpenAI/GPT/Gemini/Llama/Mistral/Cohere/Ollama named in the query; OR `grep -rE 'openai|langchain_openai|google.generativeai|genai|mistralai|cohere|ollama'` over the project hits (run this grep FIRST if no provider named — don't Read the file).Stars: 198kUpdated Claude CodeCodexUnverifiedInstall
doc-coauthoringanthropics/skillsGuide users through a structured workflow for co-authoring documentation. Use when user wants to write documentation, proposals, technical specs, decision docs, or similar structured content. This workflow helps users efficiently transfer context, refine content through iteration, and verify the doc works for readers. Trigger when user mentions writing docs, creating proposals, drafting specs, or similar documentation tasks.Stars: 198kUpdated Claude CodeCodexVerifiedInstall