<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Artificial Intelligence</title>
	<atom:link href="https://blogs.mathworks.com/deep-learning/feed/" rel="self" type="application/rss+xml" />
	<link>https://blogs.mathworks.com/deep-learning</link>
	<description>Yann is an AI Product Marketing Manager, with past experiences in open-source scientific computing. He wrote a book on &#34;MATLAB with Python&#34; and is now blogging about machine learning, deep learning and interoperability with TensorFlow and PyTorch.</description>
	<lastBuildDate>Thu, 12 Nov 2026 15:38:12 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=7.1.4</generator>
	<item>
		<title>Developing CT Reconstruction Workflows in MATLAB: From FDK to AI-Based Methods</title>
		<link>https://blogs.mathworks.com/deep-learning/2026/11/12/developing-ct-reconstruction-workflows-in-matlab-from-fdk-to-ai-based-methods/?s_tid=feedtopost</link>
					<comments>https://blogs.mathworks.com/deep-learning/2026/11/12/developing-ct-reconstruction-workflows-in-matlab-from-fdk-to-ai-based-methods/#respond</comments>
		
		<dc:creator><![CDATA[Johanna Pingel]]></dc:creator>
		<pubDate>Thu, 12 Nov 2026 15:38:12 +0000</pubDate>
				<category><![CDATA[Deep Learning]]></category>
		<guid isPermaLink="false">https://blogs.mathworks.com/deep-learning/?p=19443</guid>

					<description><![CDATA[<div class="overview-image"><img  class="img-responsive" src="https://blogs.mathworks.com/deep-learning/files/2026/11/01-ct-reconstruction-workflow-overview-cropped.png" onError="this.style.display ='none';" /></div><p>
This post is authored by Sagar Hukkire, Senior Application Engineer at MathWorks, and Visa Suomi, Medical Devices Industry Manager.
Computed tomography (CT) reconstruction transforms raw X-ray... <a class="read-more" href="https://blogs.mathworks.com/deep-learning/2026/11/12/developing-ct-reconstruction-workflows-in-matlab-from-fdk-to-ai-based-methods/">read more >></a></p>]]></description>
										<content:encoded><![CDATA[<div class="rtcContent" style="font-family: Helvetica, Arial, sans-serif; font-size: 12pt; line-height: 1.55; color: #212121;">
<div style="background-color: #e2f0ff; padding: 16px 20px; margin: 0 0 20px;"><p style="margin: 0; font-size: 12pt; line-height: 1.55;"><em>This post is authored by Sagar Hukkire, Senior Application Engineer at MathWorks, and Visa Suomi, Medical Devices Industry Manager.</em></p></div>
<p style="margin: 0 0 14px; font-size: 12pt; line-height: 1.55;">Computed tomography (CT) reconstruction transforms raw X-ray projection data into clinically useful cross-sectional and volumetric images. Cone-beam CT (CBCT) is particularly demanding: its wide cone angle and large detector coverage increase sensitivity to scatter, truncation, geometric calibration, and view-sampling effects.</p>
<p style="margin: 0 0 14px; font-size: 12pt; line-height: 1.55;">At the same time, engineering teams must balance image quality, acquisition time, radiation dose, and computational cost. A<strong> scalable</strong><strong> </strong><strong>CT reconstruction workflow </strong>must therefore support rapid<strong> experimentation, </strong>hardware <strong>acceleration, AI-based enhancement, and </strong>a practical path to <strong>deployment</strong>. This need <strong>is </strong>growing as detector sizes increase and low-dose and sparse-view acquisitions become more common.</p>
<h2 style="margin: 26px 0 12px; font-size: 20pt; line-height: 1.3; font-weight: bold;">Reconstruction Approaches</h2>
<ul style="margin: 0 0 18px; padding-left: 28px; font-size: 12pt; line-height: 1.55;">
<li style="margin: 0 0 8px;"><strong>Filtered </strong><strong>back projection</strong><strong> (FBP) with Feldkamp-Davis-Kress (FDK) reconstruction </strong>-<strong> </strong>a fast analytical baseline for circular CBCT acquisitions.</li>
<li style="margin: 0 0 8px;"><strong>Hybrid Iterative Reconstruction (HIR)</strong> – a physics-based refinement approach that improves data consistency and helps suppress artifacts.</li>
<li style="margin: 0 0 8px;"><strong>Deep Learning with a U-Net</strong> – a learned enhancement stage that maps baseline FDK slices toward higher-quality target reconstructions.</li>
</ul>
<p style="margin: 0 0 14px; font-size: 12pt; line-height: 1.55;">This blog presents an <strong>end-to-end CT reconstruction</strong> pipeline implemented in MATLAB&#174; that combines three complementary approaches. The unified workflow supports GPU acceleration, visualization, validation, CUDA&#174; code generation, and regulated medical-device software development aligned with IEC 62304.</p>
<h2 style="margin: 26px 0 12px; font-size: 20pt; line-height: 1.3; font-weight: bold;">Workflow Overview</h2>
<p style="margin: 0 0 14px; font-size: 12pt; line-height: 1.55;">The workflow spans data import, preprocessing, reconstruction, visualization, validation, and deployment. It follows the same progression as the <a href="https://blogs.mathworks.com/deep-learning/2026/08/06/developing-mri-reconstruction-workflows-in-matlab-from-k-space-to-ai-based-methods/">related MRI reconstruction series</a>: begin with a reliable analytical baseline, add physics-based refinement, and introduce AI where it provides measurable value.</p>
<figure style="margin: 20px 0; text-align: center;">
<img decoding="async" class="alignnone size-full wp-image-19456" src="https://blogs.mathworks.com/deep-learning/files/2026/11/01-ct-reconstruction-workflow-overview-cropped.png" alt="CT reconstruction workflow overview" width="850" style="display: inline-block; max-width: 100%; height: auto; vertical-align: middle;" />
</figure>
<h2 style="margin: 26px 0 12px; font-size: 20pt; line-height: 1.3; font-weight: bold;"><strong>Why Combine Multiple Reconstruction Approaches?</strong></h2>
<p style="margin: 0 0 14px; font-size: 12pt; line-height: 1.55;">CT reconstruction requires trade-offs among acquisition speed, radiation dose, image noise, spatial resolution, and artifact suppression. Dense, high-quality scans can improve reconstruction fidelity but may increase dose or acquisition time. Faster or lower-dose scans are attractive in practice, yet their noisier or less complete projection data can make reconstruction more difficult.</p>
<p style="margin: 0 0 14px; font-size: 12pt; line-height: 1.55;">Rather than relying on a single “silver bullet” algorithm, this workflow brings several reconstruction strategies into one environment. Engineers can compare methods, understand the trade-offs, and build a practical path from algorithm exploration to deployment.</p>
<ul style="margin: 0 0 18px; padding-left: 28px; font-size: 12pt; line-height: 1.55;">
<li style="margin: 0 0 8px;"><strong>Establish a reliable baseline:</strong> FDK reconstructs a full 3-D volume quickly and provides an interpretable reference point.</li>
<li style="margin: 0 0 8px;"><strong>Improve difficult scans:</strong> HIR keeps the acquisition model in the loop and refines the volume using projection-domain residuals.</li>
<li style="margin: 0 0 8px;"><strong>Use AI as an enhancement layer:</strong> the U-Net learns to reduce residual artifacts and improve slice appearance after physics-based reconstruction.</li>
</ul>
<p style="margin: 0 0 14px; font-size: 12pt; line-height: 1.55;">By unifying these approaches in MATLAB, engineers can prototype quickly, inspect intermediate results, validate image quality, and prepare selected algorithms for GPU execution and CUDA code generation without maintaining disconnected toolchains.</p>
<h2 style="margin: 26px 0 12px; font-size: 20pt; line-height: 1.3; font-weight: bold;">1. Baseline Reconstruction with FDK</h2>
<p style="margin: 0 0 14px; font-size: 12pt; line-height: 1.55;">We begin with Feldkamp–Davis–Kress (FDK) reconstruction, an analytical baseline for circular CBCT acquisitions. FDK is fast, deterministic, and directly linked to the acquisition geometry. It reconstructs a 3-D volume by applying projection weighting, filtering, and back projection to the measured projection stack.</p>
<h3 style="margin: 26px 0 12px; font-size: 15pt; line-height: 1.3; font-weight: bold;">Dataset and Simulation Setup</h3>
<p style="margin: 0 0 14px; font-size: 12pt; line-height: 1.55;">For this example, we used the XCIST simulator to generate CBCT projection data. The raw projection dataset is available through MathWorks support files.</p>
<pre class="language-matlab" style="display: block; box-sizing: border-box; max-width: 100%; overflow-x: auto; margin: 18px 0; padding: 14px 16px; background-color: #f4f6f8; border: 1px solid #d8dee5; border-radius: 4px; font-family: Consolas, monospace; font-size: 10pt; line-height: 1.5; white-space: pre; tab-size: 4;"><span class="comment">% Load projection data and run FDK reconstruction</span>
projectionData = fullfile(dataDir, &quot;CBCT_lowDose_Projections.mat&quot;);
volFDK = reconFDK(projectionData, &#39;Verbose&#39;, true);

<span class="comment">% Inside reconFDK.m</span>
S = load(inputMat);
P = S.P;
angles_rad = S.angles_rad(:)&#39;;
FDKvol = simpleFDK_CBCT_vox(P, angles_rad, DSD, DSO, ...
    [du dv], [dx dy dz], nx, ny, nz, &#39;ramp&#39;, ...
    &#39;u0&#39;, u0, &#39;v0&#39;, v0, varargin{:});</pre>
<p style="margin: 0 0 14px; font-size: 12pt; line-height: 1.55;">How it works<strong>.</strong> FDK applies geometry-aware weighting and ramp filtering to each projection before back projecting the filtered stack into a 3-D volume. The result is available immediately for review, quality checks, or use as the input to HIR and deep-learning stages.</p>
<figure style="margin: 20px 0; text-align: center;">
<img decoding="async" class="alignnone size-full wp-image-19445" src="https://blogs.mathworks.com/deep-learning/files/2026/11/02-cbct-fdk-reconstruction.png" alt="CBCT reconstruction using FDK" width="406" style="display: inline-block; max-width: 100%; height: auto; vertical-align: middle;" />
<figcaption style="margin: 8px 0 0; font-size: 11pt; line-height: 1.4; font-style: italic;">CBCT reconstruction using FDK</figcaption>
</figure>
<h2 style="margin: 26px 0 12px; font-size: 20pt; line-height: 1.3; font-weight: bold;">2. <strong>Refinement with Hybrid Iterative Reconstruction</strong></h2>
<p style="margin: 0 0 14px; font-size: 12pt; line-height: 1.55;">Hybrid Iterative Reconstruction (HIR) improves the initial FDK volume by repeatedly comparing simulated projections from the current estimate with the measured projections.</p>
<p style="margin: 0 0 14px; font-size: 12pt; line-height: 1.55;">The resulting residual is back projected to update the volume, while regularization stabilizes the reconstruction and suppresses noise.</p>
<pre class="language-matlab" style="display: block; box-sizing: border-box; max-width: 100%; overflow-x: auto; margin: 18px 0; padding: 14px 16px; background-color: #f4f6f8; border: 1px solid #d8dee5; border-radius: 4px; font-family: Consolas, monospace; font-size: 10pt; line-height: 1.5; white-space: pre; tab-size: 4;"><span class="comment">% Start from the FDK result and refine iteratively</span>
volHIR = reconIR(projectionData, volFDK, &#39;Verbose&#39;, true);

<span class="comment">% Core HIR update in reconIR.m</span>
Ax = forwardProject_CBCT(x, angles_rad, DSD, DSO, ...
    [du dv], voxel_size, nu, nv, u0, v0, ...
    &#39;UseGPU&#39;, UseGPU, &#39;NumSamples&#39;, numSamples);
res = single(P) - single(Ax);
grad = simpleFDK_CBCT_vox(res, angles_rad, DSD, DSO, ...
    [du dv], voxel_size, nx, ny, nz, &#39;ramp&#39;, ...
    &#39;u0&#39;, u0, &#39;v0&#39;, v0, &#39;UseGPU&#39;, UseGPU);
reg = lambda * (x - imgaussfilt3(x, sigG));
x = x + alpha * (grad - reg);</pre>
<p style="margin: 0 0 14px; font-size: 12pt; line-height: 1.55;"><strong>How it works</strong><strong>.</strong> Each iteration performs four steps:<strong> forward projection, residual computation, back projection, and regularization. </strong>Keeping<strong> measured projection data in the </strong>loop <strong>is especially </strong>valuable<strong> for low-dose or sparse-view </strong>scans,<strong> where analytical reconstruction alone may leave streaks, noise, or structural inconsistencies.</strong></p>
<figure style="margin: 20px 0; text-align: center;">
<img decoding="async" class="alignnone size-full wp-image-19446" src="https://blogs.mathworks.com/deep-learning/files/2026/11/03-cbct-hybrid-iterative-reconstruction.png" alt="CBCT reconstruction using Hybrid Iterative Reconstruction" width="501" style="display: inline-block; max-width: 100%; height: auto; vertical-align: middle;" />
<figcaption style="margin: 8px 0 0; font-size: 11pt; line-height: 1.4; font-style: italic;">CBCT reconstruction using Hybrid Iterative Reconstruction</figcaption>
</figure>
<h2 style="margin: 26px 0 12px; font-size: 20pt; line-height: 1.3; font-weight: bold;">3. Deep-Learning Enhancement with U-Net</h2>
<p style="margin: 0 0 14px; font-size: 12pt; line-height: 1.55;">The third approach uses <strong>deep learning</strong> to enhance CT slices reconstructed with FDK or HIR. Rather than replacing the physics-based workflow, a U-Net serves as a learned image-to-image enhancement stage. In this example, the network maps FDK-quality slices toward higher-quality targets, such as HIR outputs.</p>
<pre class="language-matlab" style="display: block; box-sizing: border-box; max-width: 100%; overflow-x: auto; margin: 18px 0; padding: 14px 16px; background-color: #f4f6f8; border: 1px solid #d8dee5; border-radius: 4px; font-family: Consolas, monospace; font-size: 10pt; line-height: 1.5; white-space: pre; tab-size: 4;"><span class="comment">% Train a U-Net that maps FDK slices toward HIR-quality slices</span>
[volDL, net, info] = reconDL(volFDK, volHIR, &#39;Verbose&#39;, true);

<span class="comment">% Key training steps in reconDL.m</span>
lgraph = buildUNet(inputSize, BASE_CHANNELS, ENCODER_DEPTH);
options = trainingOptions(&#39;adam&#39;, ...
    &#39;InitialLearnRate&#39;, 3e-4, ...
    &#39;MiniBatchSize&#39;, 8, ...
    &#39;MaxEpochs&#39;, 60, ...
    &#39;ExecutionEnvironment&#39;, char(opt.ExecEnv));
net = trainNetwork(dsTrainPrep, lgraph, options);
yPredVol(:,:,k) = tiledPredict2D(net, sliceN, tile, overlap);</pre>
<p style="margin: 0 0 14px; font-size: 12pt; line-height: 1.55;"><strong>How it works.</strong> The workflow prepares paired reconstructed slices, normalizes the data, creates training and validation partitions, trains a 2-D U-Net, and applies tiled prediction to larger slices. Used as an enhancement layer, the network can focus on residual artifacts and subtle quality improvements instead of learning the complete CT reconstruction problem from scratch.</p>
<figure style="margin: 20px 0; text-align: center;">
<img decoding="async" class="alignnone size-full wp-image-19447" src="https://blogs.mathworks.com/deep-learning/files/2026/11/04-cbct-unet-enhancement.png" alt="CBCT reconstruction enhanced using U-Net (brightness in pixel value due to contrast stretching)." width="467" style="display: inline-block; max-width: 100%; height: auto; vertical-align: middle;" />
<figcaption style="margin: 8px 0 0; font-size: 11pt; line-height: 1.4; font-style: italic;">CBCT reconstruction enhanced using U-Net (brightness in pixel value due to contrast stretching).</figcaption>
</figure>
<h2 style="margin: 26px 0 12px; font-size: 20pt; line-height: 1.3; font-weight: bold;"><strong>Verification, Validation, and Deployment</strong></h2>
<p style="margin: 0 0 14px; font-size: 12pt; line-height: 1.55;">Reconstruction algorithms are only one part of a practical CT workflow. Engineering teams also need visualization, verification, validation, performance benchmarking, and a route to deployment. Because all three reconstruction stages are implemented in MATLAB, the same environment can support both exploratory development and production-oriented engineering.</p>
<p style="margin: 0 0 14px; font-size: 12pt; line-height: 1.55;">For a 600 &#215; 600 &#215; 360 projection example running on an NVIDIA&#174; Tesla T4 GPU, acceleration substantially reduced reconstruction time:</p>
<div style="max-width: 100%; overflow-x: auto; margin: 20px 0;"><table style="width: 100%; min-width: 560px; border-collapse: collapse; font-size: 12pt; line-height: 1.45;">
<thead>
<tr>
<th scope="col" style="border: 1px solid #cbd5df; padding: 10px 12px; text-align: left; vertical-align: top; font-size: 12pt; background-color: #e2f0ff; width: 30%;">Reconstruction Method</th>
<th scope="col" style="border: 1px solid #cbd5df; padding: 10px 12px; text-align: left; vertical-align: top; font-size: 12pt; background-color: #e2f0ff;">Before Optimization (s)</th>
<th scope="col" style="border: 1px solid #cbd5df; padding: 10px 12px; text-align: left; vertical-align: top; font-size: 12pt; background-color: #e2f0ff;">After Optimization (s)</th>
<th scope="col" style="border: 1px solid #cbd5df; padding: 10px 12px; text-align: left; vertical-align: top; font-size: 12pt; background-color: #e2f0ff;">Time reduction (%)</th>
</tr>
</thead>
<tbody>
<tr>
<th scope="row" style="border: 1px solid #cbd5df; padding: 10px 12px; text-align: left; vertical-align: top; font-size: 12pt; width: 30%;">FDK-based CUDA Reconstruction</th>
<td style="border: 1px solid #cbd5df; padding: 10px 12px; text-align: left; vertical-align: top; font-size: 12pt;">~400</td>
<td style="border: 1px solid #cbd5df; padding: 10px 12px; text-align: left; vertical-align: top; font-size: 12pt;">~7</td>
<td style="border: 1px solid #cbd5df; padding: 10px 12px; text-align: left; vertical-align: top; font-size: 12pt;">~98.3%</td>
</tr>
<tr>
<th scope="row" style="border: 1px solid #cbd5df; padding: 10px 12px; text-align: left; vertical-align: top; font-size: 12pt; width: 30%;">Hybrid Iterative Reconstruction</th>
<td style="border: 1px solid #cbd5df; padding: 10px 12px; text-align: left; vertical-align: top; font-size: 12pt;">731 (per iteration)</td>
<td style="border: 1px solid #cbd5df; padding: 10px 12px; text-align: left; vertical-align: top; font-size: 12pt;">~27</td>
<td style="border: 1px solid #cbd5df; padding: 10px 12px; text-align: left; vertical-align: top; font-size: 12pt;">~96.3%</td>
</tr>
</tbody>
</table></div>
<p style="margin: 0 0 14px; font-size: 12pt; line-height: 1.55;">These results demonstrate that GPU acceleration and code generation are core parts of the workflow, not optional add-ons. The broader engineering workflow includes:</p>
<ul style="margin: 0 0 18px; padding-left: 28px; font-size: 12pt; line-height: 1.55;">
<li style="margin: 0 0 8px;"><strong>Automatic testing and verification:</strong> modular functions make it easier to add smoke tests, regression checks, and quantitative comparisons across reconstruction stages.</li>
<li style="margin: 0 0 8px;"><strong>Interactive visualization and validation:</strong> reconstructed volumes can be inspected with Medical Imaging Toolbox<img src="https://s.w.org/images/core/emoji/17.0.2/72x72/2122.png" alt="™" class="wp-smiley" style="height: 1em; max-height: 1em;" /> using slice-based and volume-based views.</li>
<li style="margin: 0 0 8px;"><strong>Parallel</strong><strong>,</strong><strong> GPU-aware execution: </strong>Accelerated<strong> MEX functions </strong>and<strong> CUDA-capable hardware </strong>make<strong> realistic 3-D reconstruction experiments more practical.</strong></li>
</ul>
<p style="margin: 0 0 14px; font-size: 12pt; line-height: 1.55;"><strong>CUDA code generation and deployment</strong><strong>.</strong><strong> MATLAB Coder</strong><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/2122.png" alt="™" class="wp-smiley" style="height: 1em; max-height: 1em;" /><strong> and GPU Coder</strong><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/2122.png" alt="™" class="wp-smiley" style="height: 1em; max-height: 1em;" /><strong> can generate accelerated MEX functions or deployment-oriented CUDA code from selected reconstruction entry points, with support for IEC 62304-oriented development workflows.</strong></p>
<pre class="language-matlab" style="display: block; box-sizing: border-box; max-width: 100%; overflow-x: auto; margin: 18px 0; padding: 14px 16px; background-color: #f4f6f8; border: 1px solid #d8dee5; border-radius: 4px; font-family: Consolas, monospace; font-size: 10pt; line-height: 1.5; white-space: pre; tab-size: 4;"><span class="comment">% Generate a CUDA MEX for the FDK entry point</span>
cfg = coder.gpuConfig(&#39;mex&#39;);
cfg.GenerateReport = true;
inputs = {P, angles_rad, DSD, DSO, du, dv, u0, v0, ...
    dx, dy, dz, padFactor};
codegen -config cfg -args inputs reconFDK_codegen</pre>
<p style="margin: 0 0 14px; font-size: 12pt; line-height: 1.55;">GPU acceleration and code generation allow CT reconstruction methods developed in MATLAB to scale from desktop prototypes to specialized hardware. This helps bridge algorithm research, AI experimentation, and integration into production-oriented medical imaging systems.</p>
<h2 style="margin: 26px 0 12px; font-size: 20pt; line-height: 1.3; font-weight: bold;"><strong>Conclusion and Key Takeaways</strong></h2>
<p style="margin: 0 0 14px; font-size: 12pt; line-height: 1.55;">Combining analytical, iterative, and AI-based reconstruction in one MATLAB workflow addresses the varied requirements of modern CT systems. A unified environment streamlines raw-data import, reconstruction, testing, visualization, validation, GPU acceleration, and code generation.</p>
<p style="margin: 0 0 14px; font-size: 12pt; line-height: 1.55;">The main takeaways are:</p>
<ul style="margin: 0 0 18px; padding-left: 28px; font-size: 12pt; line-height: 1.55;">
<li style="margin: 0 0 8px;"><strong>FDK reconstruction</strong> provides a fast and interpretable baseline for CBCT data.</li>
<li style="margin: 0 0 8px;"><strong>Hybrid iterative reconstruction improves fidelity by combining forward projection, residual correction, back projection, and regularization.</strong></li>
<li style="margin: 0 0 8px;"><strong>Deep learning</strong> can enhance reconstruction quality when trained and validated with representative target data.</li>
<li style="margin: 0 0 8px;"><strong>GPU acceleration and CUDA code generation</strong> help bridge the gap between research prototypes and deployable reconstruction pipelines, with the example workflow showing about 57&#215; speedup for FDK and about 27&#215; speedup per iteration for HIR on an NVIDIA&#174; Tesla T4 GPU.</li>
</ul>
<p style="margin: 0 0 14px; font-size: 12pt; line-height: 1.55;">Together, FDK, HIR, and U-Net enhancement create a flexible workflow in which classical reconstruction and AI reinforce each other. Engineers can iterate quickly, compare trade-offs clearly, and tailor CT reconstruction pipelines for both image quality and deployment readiness.</p>
<h2 style="margin: 26px 0 12px; font-size: 20pt; line-height: 1.3; font-weight: bold;">Try the Examples</h2>
<p style="margin: 0 0 14px; font-size: 12pt; line-height: 1.55;"><a href="https://github.com/mathworks/CT-Reconstruction-in-MATLAB">CT Reconstruction in MATLAB</a></p>
</div>]]></content:encoded>
					
					<wfw:commentRss>https://blogs.mathworks.com/deep-learning/2026/11/12/developing-ct-reconstruction-workflows-in-matlab-from-fdk-to-ai-based-methods/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Engineering Embedded AI with MATLAB Agentic Toolkit</title>
		<link>https://blogs.mathworks.com/deep-learning/2026/11/03/engineering-embedded-ai-with-matlab-agentic-toolkit/?s_tid=feedtopost</link>
					<comments>https://blogs.mathworks.com/deep-learning/2026/11/03/engineering-embedded-ai-with-matlab-agentic-toolkit/#respond</comments>
		
		<dc:creator><![CDATA[Johanna Pingel]]></dc:creator>
		<pubDate>Tue, 03 Nov 2026 20:42:54 +0000</pubDate>
				<category><![CDATA[Deep Learning]]></category>
		<guid isPermaLink="false">https://blogs.mathworks.com/deep-learning/?p=19434</guid>

					<description><![CDATA[<div class="overview-image"><img src="https://blogs.mathworks.com/deep-learning/files/2026/11/03-battery-soc-accuracy-storage-pareto.png" class="img-responsive attachment-post-thumbnail size-post-thumbnail wp-post-image" alt="" decoding="async" fetchpriority="high" /></div><p>




Guest blogger: Arkadiy TurevskiyArkadiy is the product manager for AI and controls products at MathWorks. He has been with MathWorks for more than 20 years. Before joining MathWorks, he... <a class="read-more" href="https://blogs.mathworks.com/deep-learning/2026/11/03/engineering-embedded-ai-with-matlab-agentic-toolkit/">read more >></a></p>]]></description>
										<content:encoded><![CDATA[<!-- WordPress title: Engineering Embedded AI with MATLAB Agentic Toolkit -->
<div class="rtcContent" style="font-size: 12pt; line-height: 1.5;">
<!-- Guest blogger introduction -->
<div style="display: flex; flex-wrap: wrap; align-items: center; gap: 24px; background-color: #e2f0ff; padding: 20px; margin: 0 0 24px;">
<div style="flex: 0 0 152px; margin: 0; line-height: 0;"><img decoding="async" src="https://blogs.mathworks.com/deep-learning/files/2026/11/01-arkadiy-turevskiy.png" class="alignnone size-full wp-image-19435" alt="Arkadiy Turevskiy" width="152" style="display: block !important; width: 152px; max-width: 100% !important; height: auto; margin: 0; float: none;" /></div>
<div style="flex: 1 1 260px; min-width: 0; margin: 0; font-size: 12pt; line-height: 1.5;"><p style="margin: 0 0 12px; font-size: 12pt; line-height: 1.5;"><strong>Guest blogger: </strong><a href="https://www.linkedin.com/in/arkadiy-turevskiy/"><strong>Arkadiy Turevskiy</strong></a></p><p style="margin: 0; font-size: 12pt; line-height: 1.5;">Arkadiy is the product manager for AI and controls products at MathWorks. He has been with MathWorks for more than 20 years. Before joining MathWorks, he designed aircraft engine control systems at Pratt &amp; Whitney.</p></div>
</div>
<p style="font-size: 12pt; line-height: 1.5;">Developing an embedded AI application involves preparing data, training a network, reducing its memory requirements, and verifying the generated code. These steps require engineering judgment about accuracy, resource constraints, and implementation behavior. I wanted to explore how a coding agent could help carry out this workflow using reusable engineering guidance, while keeping me involved in the decisions.</p>
<p style="font-size: 12pt; line-height: 1.5;">My test case was a battery state-of-charge estimator intended for an Arm Cortex-M7 processor. The objective was to minimize storage for the network’s weights and biases while allowing no more than a 5% increase in root mean squared error (RMSE) relative to the uncompressed network.</p>
<p style="font-size: 12pt; line-height: 1.5;">I asked a coding agent to use the <a href="https://github.com/matlab/matlab-agentic-toolkit/tree/main/skills-catalog/ai-and-statistics/matlab-deploy-embedded-ai">matlab-deploy-embedded-ai skill</a> in <a href="https://www.mathworks.com/products/matlab-agentic-toolkit.html">MATLAB Agentic Toolkit</a> with battery data from the <a href="https://www.mathworks.com/help/deeplearning/ug/prepare-data-for-battery-state-of-charge-estimation.html">state-of-charge estimation example</a>. The objective was to train a deep learning virtual sensor in MATLAB&#174;, integrate it into Simulink&#174;, and generate C code for deployment. The sensor estimates battery state of charge from temperature, voltage, and current measurements.</p>
<h2 style="font-size: 20pt; line-height: 1.25; margin: 24px 0 10px;">Package Best Practices with the Code</h2>
<p style="font-size: 12pt; line-height: 1.5;">Large language models train on vast amounts of source code, so a coding agent can quickly write a deep learning training script. Engineering practice is harder to learn from public data. It lives in an organization’s standards, project reviews, and experience.</p>
<p style="font-size: 12pt; line-height: 1.5;">That knowledge may live in an engineer’s head, but putting it into every prompt is impractical. A skill file makes the guidance reusable.</p>
<p style="font-size: 12pt; line-height: 1.5;">A skill packages best practices as readable, versioned markdown that engineers can inspect. The agent usually invokes a relevant skill from your prompt, but in my experience, it occasionally failed. To make sure, name it explicitly. In Codex, type $matlab-deploy-embedded-ai or tell the agent to use matlab-deploy-embedded-ai.</p>
<p style="font-size: 12pt; line-height: 1.5;">The Embedded AI skill gives the agent a workflow to follow, including recommended functions, verification steps, and review checkpoints. For example, the skill directs the agent to train the neural network with <a href="https://www.mathworks.com/help/deeplearning/ref/trainnet.html">trainnet</a>, then open the trained network in <a href="https://www.mathworks.com/help/deeplearning/deep-network-designer-app.html">Deep Network Designer</a> for my review. The next step is model compression: reducing the storage required for the network’s weights and biases while evaluating the effect on prediction accuracy. The skill also calls for numerical comparisons between the approved network in MATLAB, its Simulink implementation, and generated code. At each checkpoint, the agent saves a script and presents results for my review before continuing. MATLAB Agentic Toolkit and Simulink Agentic Toolkit connected the agent to a live MATLAB session for running scripts, simulating models, and reporting results.</p>
<p style="font-size: 12pt; line-height: 1.5;">Reviewing each step let me correct a wrong turn before it propagated.</p>
<h2 style="font-size: 20pt; line-height: 1.25; margin: 24px 0 10px;">Let Requirements Choose the Model</h2>
<p style="font-size: 12pt; line-height: 1.5;">The battery data spanned −10, 0, 10, and 25 &#176;C. I followed the data preparation procedure in the MATLAB state-of-charge estimation example, dividing the data into 500-step sequences and using a 70/30 training–validation split. This produced 201 training and 87 validation sequences. The example’s separate test data yielded 288 test sequences. The baseline network had 463,489 learnable parameters and achieved an RMSE of 0.034258 on the independent test set.</p>
<p style="text-align: center;"><img decoding="async" src="https://blogs.mathworks.com/deep-learning/files/2026/11/02-battery-soc-deep-network-designer.png" class="alignnone size-full wp-image-19436" alt="Battery state-of-charge sequence network with two LSTM layers displayed in Deep Network Designer" width="850" style="max-width: 100%; height: auto;" /></p>
<p style="text-align: center; font-style: italic; font-size: 11pt; line-height: 1.5;">Figure 1: The agent opened the trained battery state-of-charge network in Deep Network Designer for review before compression.</p>
<p style="font-size: 12pt; line-height: 1.5;">After training, I wanted to compress the model for a resource-constrained microcontroller. I used a Pareto frontier to compare accuracy and parameter storage. Projection and quantization can reduce parameter storage, alone or together, with different accuracy tradeoffs.</p>
<p style="font-size: 12pt; line-height: 1.5;">Compression methods need to suit the network architecture. For this network, I compared projection, which reduces the number of parameters in its long short-term memory (LSTM) layers, and quantization, which uses lower-precision numbers. I evaluated the methods separately and together.</p>
<p style="font-size: 12pt; line-height: 1.5;">I allowed no more than a 5% increase in RMSE relative to the uncompressed model. The agent calibrated the quantized candidates on all 201 training sequences and evaluated the three compressed candidates on the same 32 held-out sequences. Using a common comparison set kept a change in data from looking like a change in model performance.</p>
<p style="font-size: 12pt; line-height: 1.5;">Here, parameter storage means the memory that <a href="https://www.mathworks.com/help/deeplearning/ref/estimatenetworkmetrics.html">estimateNetworkMetrics</a> reports for learnable weights and biases. It is a proxy for flash or ROM and excludes generated code, network states, activations, and runtime SRAM.</p>
<div style="overflow-x: auto;"><table style="width: 100%; border-collapse: collapse; margin-bottom: 9px; table-layout: fixed;">
<colgroup><col style="width: 39%;" /><col style="width: 25%;" /><col style="width: 20%;" /><col style="width: 16%;" /></colgroup>
<thead>
<tr>
<th scope="col" style="font-size: 12pt; line-height: 1.5; border: 1px solid #d1d9e0; padding: 8px 10px; text-align: left; vertical-align: top; overflow-wrap: break-word; background-color: #e2f0ff;"><strong>Candidate</strong></th>
<th scope="col" style="font-size: 12pt; line-height: 1.5; border: 1px solid #d1d9e0; padding: 8px 10px; text-align: left; vertical-align: top; overflow-wrap: break-word; background-color: #e2f0ff;"><strong>Parameter storage</strong></th>
<th scope="col" style="font-size: 12pt; line-height: 1.5; border: 1px solid #d1d9e0; padding: 8px 10px; text-align: left; vertical-align: top; overflow-wrap: break-word; background-color: #e2f0ff;"><strong>RMSE change</strong></th>
<th scope="col" style="font-size: 12pt; line-height: 1.5; border: 1px solid #d1d9e0; padding: 8px 10px; text-align: left; vertical-align: top; overflow-wrap: break-word; background-color: #e2f0ff;"><strong>5% budget</strong></th>
</tr>
</thead><tbody>
<tr>
<th scope="row" style="font-size: 12pt; line-height: 1.5; border: 1px solid #d1d9e0; padding: 8px 10px; text-align: left; vertical-align: top; overflow-wrap: break-word; font-weight: normal;">Uncompressed: Baseline float32</th>
<td style="font-size: 12pt; line-height: 1.5; border: 1px solid #d1d9e0; padding: 8px 10px; text-align: left; vertical-align: top; overflow-wrap: break-word;">1.768 MB</td>
<td style="font-size: 12pt; line-height: 1.5; border: 1px solid #d1d9e0; padding: 8px 10px; text-align: left; vertical-align: top; overflow-wrap: break-word;">Baseline</td>
<td style="font-size: 12pt; line-height: 1.5; border: 1px solid #d1d9e0; padding: 8px 10px; text-align: left; vertical-align: top; overflow-wrap: break-word;">Pass</td>
</tr>
<tr>
<th scope="row" style="font-size: 12pt; line-height: 1.5; border: 1px solid #d1d9e0; padding: 8px 10px; text-align: left; vertical-align: top; overflow-wrap: break-word; font-weight: normal;">Projected float32</th>
<td style="font-size: 12pt; line-height: 1.5; border: 1px solid #d1d9e0; padding: 8px 10px; text-align: left; vertical-align: top; overflow-wrap: break-word;">0.0464 MB</td>
<td style="font-size: 12pt; line-height: 1.5; border: 1px solid #d1d9e0; padding: 8px 10px; text-align: left; vertical-align: top; overflow-wrap: break-word;">+1.64%</td>
<td style="font-size: 12pt; line-height: 1.5; border: 1px solid #d1d9e0; padding: 8px 10px; text-align: left; vertical-align: top; overflow-wrap: break-word;">Pass</td>
</tr>
<tr>
<th scope="row" style="font-size: 12pt; line-height: 1.5; border: 1px solid #d1d9e0; padding: 8px 10px; text-align: left; vertical-align: top; overflow-wrap: break-word; font-weight: normal;">Quantized baseline</th>
<td style="font-size: 12pt; line-height: 1.5; border: 1px solid #d1d9e0; padding: 8px 10px; text-align: left; vertical-align: top; overflow-wrap: break-word;">0.4464 MB</td>
<td style="font-size: 12pt; line-height: 1.5; border: 1px solid #d1d9e0; padding: 8px 10px; text-align: left; vertical-align: top; overflow-wrap: break-word;">−3.94%</td>
<td style="font-size: 12pt; line-height: 1.5; border: 1px solid #d1d9e0; padding: 8px 10px; text-align: left; vertical-align: top; overflow-wrap: break-word;">Pass</td>
</tr>
<tr>
<th scope="row" style="font-size: 12pt; line-height: 1.5; border: 1px solid #d1d9e0; padding: 8px 10px; text-align: left; vertical-align: top; overflow-wrap: break-word; font-weight: normal;">Projected and quantized</th>
<td style="font-size: 12pt; line-height: 1.5; border: 1px solid #d1d9e0; padding: 8px 10px; text-align: left; vertical-align: top; overflow-wrap: break-word;">0.0160 MB</td>
<td style="font-size: 12pt; line-height: 1.5; border: 1px solid #d1d9e0; padding: 8px 10px; text-align: left; vertical-align: top; overflow-wrap: break-word;">−0.62%</td>
<td style="font-size: 12pt; line-height: 1.5; border: 1px solid #d1d9e0; padding: 8px 10px; text-align: left; vertical-align: top; overflow-wrap: break-word;">Pass</td>
</tr>
</tbody></table></div>
<p style="text-align: center; font-style: italic; font-size: 11pt; line-height: 1.5;">Table 1: Measured results on the same 32-sequence comparison set. RMSE change is relative to the baseline on that set; negative values indicate lower RMSE.</p>
<p style="text-align: center;"><img decoding="async" src="https://blogs.mathworks.com/deep-learning/files/2026/11/03-battery-soc-accuracy-storage-pareto.png" class="alignnone size-full wp-image-19437" alt="Plot of parameter storage versus RMSE change for four model candidates. A dashed line marks the 5% RMSE limit, and the projected and quantized model is identified as the selected model." width="850" style="max-width: 100%; height: auto;" /></p>
<p style="text-align: center; font-style: italic; font-size: 11pt; line-height: 1.5;">Figure 2: The measured Pareto frontier for the four candidates.</p>
<p style="font-size: 12pt; line-height: 1.5;">At 0.0160 MB, the projected and quantized model cut parameter storage by 99.10% versus float32. Its RMSE was 0.62% lower on the 32-sequence comparison set and 8.69% lower on the full validation set. I selected it as the smallest candidate within the limit.</p>
<blockquote style="background-color: #e2f0ff; border-left: 3px solid #0f4761; padding: 12px 16px; margin: 16px 0;">
<p style="font-size: 12pt; line-height: 1.5;"><strong>Agent:</strong> The projected and quantized model is the smallest within the 5% RMSE budget. Its RMSE is also 0.62% below baseline on the comparison set. Next comes Simulink integration and numerical equivalence testing. Shall I proceed?</p>
<p style="font-size: 12pt; line-height: 1.5;"><strong>Engineer:</strong> Yes, but first explain how the quantized model could have lower RMSE.</p>
<p style="font-size: 12pt; line-height: 1.5;"><strong>Agent:</strong> Quantization rounds values to the nearest value representable at lower precision. On this dataset, those changes happened to move predictions closer to the targets. The result is specific to this model and data; quantization does not generally reduce RMSE.</p>
<p style="font-size: 12pt; line-height: 1.5;"><strong>Engineer:</strong> Ok, proceed.</p>
<p style="font-size: 12pt; line-height: 1.5;"><strong>Agent:</strong> The Simulink equivalence test passed. The next step is code generation and software-in-the-loop testing. Shall I proceed?</p>
<p style="font-size: 12pt; line-height: 1.5;"><strong>Engineer:</strong> Go ahead.</p>
</blockquote>
<h2 style="font-size: 20pt; line-height: 1.25; margin: 24px 0 10px;">Separate Compression Effects from Implementation Drift</h2>
<p style="font-size: 12pt; line-height: 1.5;">Compression changes a model, so its acceptance test measures application performance on held-out data. That is the RMSE comparison above. Implementation testing asks a different question: Does the approved model produce equivalent numerical results as it moves from MATLAB to Simulink and generated code?</p>
<p style="font-size: 12pt; line-height: 1.5;">I had the agent run one 500-step sequence at each temperature, producing 2,000 outputs for each implementation. The quantized network in MATLAB, normal Simulink simulation, and software-in-the-loop (SIL) simulation produced bit-identical outputs on those test vectors. MAE, RMSE, and maximum error were all exactly zero. Those zeros measure implementation drift, not prediction error against the measured state of charge.</p>
<p style="font-size: 12pt; line-height: 1.5;">C code generation completed with an Arm Cortex-M configuration, and the generated source used fixed-width integer types. The quantized workflow reported a fixed-point saturation warning in the second LSTM layer. The implementations still showed no drift in this test, and any effect on model quality was already reflected in the held-out RMSE. The warning warrants broader testing. Without a development board or cross-compiler, flash use, SRAM use, and execution time remain unmeasured. The agent stopped its claims at that boundary.</p>
<h2 style="font-size: 20pt; line-height: 1.25; margin: 24px 0 10px;">Let Proven Tools Produce the Evidence</h2>
<p style="font-size: 12pt; line-height: 1.5;">You may reasonably ask whether the agent invented those metrics. It did not estimate them. The agent orchestrated the workflow; MATLAB, Simulink, code generation, and verification produced the evidence. I set requirements, reviewed tradeoffs, and approved important decisions.</p>
<p style="font-size: 12pt; line-height: 1.5;">The skill tells the agent to compute metrics from current variables and avoid hard-coded results. The LLM remains nondeterministic and unqualified. With the network, test data, and configuration fixed, code generation and test execution follow repeatable procedures. In qualified workflows, qualification belongs to the specific tools, process, and project evidence. It never extends to the coding agent.</p>
<h2 style="font-size: 20pt; line-height: 1.25; margin: 24px 0 10px;">Make the Workflow Reusable</h2>
<p style="font-size: 12pt; line-height: 1.5;"><a href="https://blogs.mathworks.com/deep-learning/2026/06/08/an-ai-coding-agent-for-embedded-ai/">My earlier post</a> introduced an early version of this skill in the <a href="https://github.com/matlab/agent-skills-playground">MATLAB Agent Skills Playground</a>. Since then, broader testing with coding agents such as Claude and Codex has shown that the skill helps agents complete user objectives and select recommended MATLAB functions and capabilities more consistently. The skill is now available in <a href="https://github.com/matlab/matlab-agentic-toolkit">MATLAB Agentic Toolkit</a>.</p>
<p style="font-size: 12pt; line-height: 1.5;">Because skills are text files, teams can review them, place them under version control, and adapt them with their own budgets, tests, reports, and approval gates. Try the Embedded AI skill with a real deployment objective: inspect the scripts, challenge the model choice, and trace the measurements. A useful engineering agent should make expert practice easier to apply while leaving the evidence and final decisions where they belong.</p>
<p style="font-size: 10pt; line-height: 1.5; margin-top: 24px;">&#169; 2026 The MathWorks, Inc. MATLAB and Simulink are registered trademarks of The MathWorks, Inc. See <a href="https://www.mathworks.com/trademarks">mathworks.com/trademarks</a> for a list of additional trademarks. Other product or brand names may be trademarks or registered trademarks of their respective holders.</p>
</div>
]]></content:encoded>
					
					<wfw:commentRss>https://blogs.mathworks.com/deep-learning/2026/11/03/engineering-embedded-ai-with-matlab-agentic-toolkit/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Teaching AI Agents How Engineers Work</title>
		<link>https://blogs.mathworks.com/deep-learning/2026/10/27/teaching-ai-agents-how-engineers-work/?s_tid=feedtopost</link>
					<comments>https://blogs.mathworks.com/deep-learning/2026/10/27/teaching-ai-agents-how-engineers-work/#respond</comments>
		
		<dc:creator><![CDATA[Johanna Pingel]]></dc:creator>
		<pubDate>Tue, 27 Oct 2026 13:12:04 +0000</pubDate>
				<category><![CDATA[Deep Learning]]></category>
		<guid isPermaLink="false">https://blogs.mathworks.com/deep-learning/?p=19412</guid>

					<description><![CDATA[<div class="overview-image"><img  class="img-responsive" src="https://blogs.mathworks.com/deep-learning/files/2026/10/01-grounding-ai-in-engineering-tools-scaled.png" onError="this.style.display ='none';" /></div><p>




Guest blogger: Akash Gopisetty
I&#39;m pleased to welcome guest blogger Akash Gopisetty, Product Marketing Manager, Radar and Signal Processing. Akash explores how reusable skills help AI... <a class="read-more" href="https://blogs.mathworks.com/deep-learning/2026/10/27/teaching-ai-agents-how-engineers-work/">read more >></a></p>]]></description>
										<content:encoded><![CDATA[<!-- WordPress title: Teaching AI Agents How Engineers Work -->
<div class="rtcContent" style="font-size: 12pt; line-height: 1.5;">
<!-- Guest blogger introduction -->
<table style="width: 100%; background-color: #e2f0ff; margin-bottom: 18px; border-collapse: collapse;">
<tbody><tr><td style="padding: 14px; font-size: 12pt; line-height: 1.5;">
<p style="font-size: 12pt; line-height: 1.5; margin: 0 0 8px;"><strong>Guest blogger: Akash Gopisetty</strong></p>
<p style="font-size: 12pt; line-height: 1.5; margin: 0;">I&#39;m pleased to welcome guest blogger <strong>Akash Gopisetty, Product Marketing Manager, Radar and Signal Processing</strong>. Akash explores how reusable skills help AI agents follow established engineering methods.</p>
</td></tr></tbody>
</table>

<p style="font-size: 12pt; line-height: 1.5;">Connecting AI agents to engineering tools gives them the ability to write code, execute workflows and evaluate results, all within an established engineering environment. This ensures the results are inspectable, testable and verifiable. </p>
<p style="text-align: center;"><img decoding="async" src="https://blogs.mathworks.com/deep-learning/files/2026/10/01-grounding-ai-in-engineering-tools-scaled.png" class="alignnone size-full wp-image-19413" alt="Grounding AI in engineering tools" width="650" style="width: 650px; max-width: 100%; height: auto;" /></p>
<p style="text-align: center; font-style: italic; font-size: 12pt;">Figure 1: Grounding AI in engineering tools</p>
<p style="font-size: 12pt; line-height: 1.5;">However, access to engineering tools alone does not provide the agent with the domain expertise needed to solve specialized engineering problems. That is where skills come in.</p>
<p style="font-size: 12pt; line-height: 1.5;">Skills are a way to capture how an experienced engineer would approach a problem. They are especially useful in technical domains like wireless communication, signal processing, and RF and antenna design, where there may be multiple valid approaches and the right choice depends on domain-specific assumptions, selecting the right methods and engineering tradeoffs. For example, an RF or antenna engineer may need to translate requirements for frequency, gain, coverage and polarization into various antenna and array architecture. They may also need to factor in impedance matching, mutual coupling and array effects and evaluate whether the resulting design meets the system-level performance requirements. Skills could be used to capture this reasoning and guide the agent through a workflow, allowing the engineer to focus on reviewing the design choices and exercising judgement over the final design. </p>
<p style="font-size: 12pt; line-height: 1.5;">Instead of asking an agent to discover or guess the right procedure at each prompt, engineers can codify proven methods into skills, version them like any other artifact and reuse them across relevant workflows and across compatible AI agents. </p>
<p style="font-size: 12pt; line-height: 1.5;">Skills are especially valuable when workflows require:</p>
<ul style="font-size: 12pt; line-height: 1.5;">
<li style="font-size: 12pt; line-height: 1.5;"><strong>Domain knowledge:</strong> The assumptions, calculations, tool choices, and validation steps that define a sound approach to tasks such as digital filter design, standards-based wireless waveform generation, model calibration, or test development.</li>
<li style="font-size: 12pt; line-height: 1.5;"><strong>Consistency and </strong><strong>traceability:</strong> A repeatable workflow whose instructions can be reviewed, tested, audited, and improved like any other engineering artifact.</li>
<li style="font-size: 12pt; line-height: 1.5;"><strong>Reusability:</strong> A portable way to apply the same engineering process across projects, teams, and compatible AI agents without rebuilding the guidance from scratch.</li>
</ul>
<h2 style="font-size: 20pt; line-height: 1.25;">Using Agentic AI Skills with MATLAB:</h2>
<p style="font-size: 12pt; line-height: 1.5;">AI Agents can be connected to MATLAB using <a href="https://www.mathworks.com/products/matlab-agentic-toolkit.html">MATLAB Agentic Toolkit</a>. With the guardrails of MATLAB engineers can produce verifiable results with AI Agents. For technical domains like radar, communications, RF and mixed signal design the toolkit also includes a <a href="https://github.com/matlab/matlab-agentic-toolkit/tree/main/skills-catalog">catalog of reusable skills</a>. </p>
<p style="text-align: center;"><img decoding="async" src="https://blogs.mathworks.com/deep-learning/files/2026/10/02-connect-ai-agents-to-matlab-cropped.png" class="alignnone size-full wp-image-19430" alt="Three-step flow diagram: AI Agent (Claude, Copilot, etc.) connects to an MCP Server (Protocol Bridge), which connects to MATLAB (Executes Code)." width="716" style="max-width: 100%; height: auto;" /></p>
<p style="text-align: center; font-style: italic; font-size: 12pt;">Figure 2: Connect AI Agents to MATLAB</p>
<p style="font-size: 12pt; line-height: 1.5;">You don&#39;t need to choose individual skills for each task. Install the skill groups relevant to your work, and the agent can identify and apply appropriate skills based on your request.</p>
<div style="overflow-x: auto;"><table style="width: 100%; border-collapse: collapse; margin-bottom: 9px; table-layout: fixed;">
<colgroup><col style="width: 25%;" /><col style="width: 75%;" /></colgroup>
<thead><tr><th scope="col" style="font-size: 12pt; line-height: 1.5; border: 1px solid #d1d9e0; padding: 8px 10px; text-align: left; vertical-align: top; overflow-wrap: break-word; background-color: #e2f0ff;">Skill Group</th><th scope="col" style="font-size: 12pt; line-height: 1.5; border: 1px solid #d1d9e0; padding: 8px 10px; text-align: left; vertical-align: top; overflow-wrap: break-word; background-color: #e2f0ff;">Example Workflows</th></tr></thead><tbody>
<tr><th scope="row" style="font-size: 12pt; line-height: 1.5; border: 1px solid #d1d9e0; padding: 8px 10px; text-align: left; vertical-align: top; overflow-wrap: break-word;"><a href="https://github.com/matlab/matlab-agentic-toolkit/tree/main/skills-catalog/radar">Radar</a></th>
<td style="font-size: 12pt; line-height: 1.5; border: 1px solid #d1d9e0; padding: 8px 10px; text-align: left; vertical-align: top; overflow-wrap: break-word;"><ul style="margin: 0; padding-left: 20px; font-size: 12pt; line-height: 1.5;"><li style="font-size: 12pt; line-height: 1.5;">Design and analyze radar waveforms</li><li style="font-size: 12pt; line-height: 1.5;">Design radar systems in Radar Designer</li><li style="font-size: 12pt; line-height: 1.5;">Simulate radar detections</li></ul></td></tr>
<tr><th scope="row" style="font-size: 12pt; line-height: 1.5; border: 1px solid #d1d9e0; padding: 8px 10px; text-align: left; vertical-align: top; overflow-wrap: break-word;"><a href="https://github.com/matlab/matlab-agentic-toolkit/tree/main/skills-catalog/reporting-and-database-access">Reporting and Database Access</a></th>
<td style="font-size: 12pt; line-height: 1.5; border: 1px solid #d1d9e0; padding: 8px 10px; text-align: left; vertical-align: top; overflow-wrap: break-word;"><ul style="margin: 0; padding-left: 20px; font-size: 12pt; line-height: 1.5;"><li style="font-size: 12pt; line-height: 1.5;">Generate MATLAB and Simulink reports</li><li style="font-size: 12pt; line-height: 1.5;">Read and write relational databases</li><li style="font-size: 12pt; line-height: 1.5;">Connect MATLAB to Databricks</li></ul></td></tr>
<tr><th scope="row" style="font-size: 12pt; line-height: 1.5; border: 1px solid #d1d9e0; padding: 8px 10px; text-align: left; vertical-align: top; overflow-wrap: break-word;"><a href="https://github.com/matlab/matlab-agentic-toolkit/tree/main/skills-catalog/rf-and-mixed-signal">RF and Mixed Signal</a></th>
<td style="font-size: 12pt; line-height: 1.5; border: 1px solid #d1d9e0; padding: 8px 10px; text-align: left; vertical-align: top; overflow-wrap: break-word;"><ul style="margin: 0; padding-left: 20px; font-size: 12pt; line-height: 1.5;"><li style="font-size: 12pt; line-height: 1.5;">Design antennas and arrays</li><li style="font-size: 12pt; line-height: 1.5;">Model and simulate RF systems</li><li style="font-size: 12pt; line-height: 1.5;">Model PLL frequency synthesizers</li></ul></td></tr>
<tr><th scope="row" style="font-size: 12pt; line-height: 1.5; border: 1px solid #d1d9e0; padding: 8px 10px; text-align: left; vertical-align: top; overflow-wrap: break-word;"><a href="https://github.com/matlab/matlab-agentic-toolkit/tree/main/skills-catalog/robotics-and-autonomous-systems">Robotics and Autonomous Systems</a></th>
<td style="font-size: 12pt; line-height: 1.5; border: 1px solid #d1d9e0; padding: 8px 10px; text-align: left; vertical-align: top; overflow-wrap: break-word;"><ul style="margin: 0; padding-left: 20px; font-size: 12pt; line-height: 1.5;"><li style="font-size: 12pt; line-height: 1.5;">Build robot manipulator models</li><li style="font-size: 12pt; line-height: 1.5;">Plan robot motion and trajectories</li><li style="font-size: 12pt; line-height: 1.5;">Fuse inertial sensor measurements</li></ul></td></tr>
<tr><th scope="row" style="font-size: 12pt; line-height: 1.5; border: 1px solid #d1d9e0; padding: 8px 10px; text-align: left; vertical-align: top; overflow-wrap: break-word;"><a href="https://github.com/matlab/matlab-agentic-toolkit/tree/main/skills-catalog/signal-processing">Signal Processing</a></th>
<td style="font-size: 12pt; line-height: 1.5; border: 1px solid #d1d9e0; padding: 8px 10px; text-align: left; vertical-align: top; overflow-wrap: break-word;"><ul style="margin: 0; padding-left: 20px; font-size: 12pt; line-height: 1.5;"><li style="font-size: 12pt; line-height: 1.5;">Design and validate digital filters</li><li style="font-size: 12pt; line-height: 1.5;">Analyze signal spectra</li><li style="font-size: 12pt; line-height: 1.5;">Analyze time-frequency content</li></ul></td></tr>
<tr><th scope="row" style="font-size: 12pt; line-height: 1.5; border: 1px solid #d1d9e0; padding: 8px 10px; text-align: left; vertical-align: top; overflow-wrap: break-word;"><a href="https://github.com/matlab/matlab-agentic-toolkit/tree/main/skills-catalog/test-and-measurement">Test and Measurement</a></th>
<td style="font-size: 12pt; line-height: 1.5; border: 1px solid #d1d9e0; padding: 8px 10px; text-align: left; vertical-align: top; overflow-wrap: break-word;"><ul style="margin: 0; padding-left: 20px; font-size: 12pt; line-height: 1.5;"><li style="font-size: 12pt; line-height: 1.5;">Connect to cameras and acquire images</li><li style="font-size: 12pt; line-height: 1.5;">Connect to OPC UA servers and browse nodes</li><li style="font-size: 12pt; line-height: 1.5;">Set up CAN and CAN FD communication</li></ul></td></tr>
<tr><th scope="row" style="font-size: 12pt; line-height: 1.5; border: 1px solid #d1d9e0; padding: 8px 10px; text-align: left; vertical-align: top; overflow-wrap: break-word;"><a href="https://github.com/matlab/matlab-agentic-toolkit/tree/main/skills-catalog/wireless-communications">Wireless Communications</a></th>
<td style="font-size: 12pt; line-height: 1.5; border: 1px solid #d1d9e0; padding: 8px 10px; text-align: left; vertical-align: top; overflow-wrap: break-word;"><ul style="margin: 0; padding-left: 20px; font-size: 12pt; line-height: 1.5;"><li style="font-size: 12pt; line-height: 1.5;">Generate 5G NR waveforms</li><li style="font-size: 12pt; line-height: 1.5;">Generate IEEE 802.11 waveforms</li><li style="font-size: 12pt; line-height: 1.5;">Transmit and capture RF waveforms with USRP radios</li></ul></td></tr>
</tbody></table></div>
<p style="text-align: center; font-style: italic; font-size: 12pt;">Table 1: Selected MATLAB Agentic Toolkit skill groups and example workflows</p>
<h2 style="font-size: 20pt; line-height: 1.25;">Applying Skills to a Real-World Design Challenge:</h2>
<p style="font-size: 12pt; line-height: 1.5;">Let’s put these skills to the test. Consider a wireless system that uses the same infrastructure and spectrum for both communication and radar sensing. Commonly referred to as Integrated Sensing and Communication (ISAC), this approach enables a system to exchange data while also detecting and locating objects in its coverage area. ISAC is becoming increasingly important as wireless spectrum grows more congested.</p>
<p style="font-size: 12pt; line-height: 1.5;">In this example, an ISAC base station operates at 28 GHz and must sense targets within its coverage area while communicating in spectrum shared with a neighboring system. The sensing waveform must provide the required range resolution, maintain low range sidelobes, and minimize transmitted energy within the portion of the band occupied by the neighboring system.</p>
<p style="font-size: 12pt; line-height: 1.5;"><strong>The ask.</strong> The agent was given a single prompt (below) describing the system goals, while specific functions and preferred design methods were intentionally omitted. The agent was asked to formulate a plan before implementing any code. The skills included in the MATLAB Agentic Toolkit should help the agent select the appropriate tools and workflow.</p>
<blockquote style="background-color: #e2f0ff; border-left: 3px solid #0f4761; padding: 12px 16px; margin: 16px 0;"><p style="font-size: 12pt; line-height: 1.5;">I&#39;m working on an ISAC system. A 28 GHz base station panel needs to sense targets in its coverage area while a neighboring operator uses part of the band. Design a pulsed sensing waveform in MATLAB that gives me 2 m range resolution, keeps range sidelobes below 40 dB, and puts as little energy as possible into the 100 MHz slice at the center of my sweep where the other system operates. Explain your approach before writing any code.</p></blockquote>
<p style="font-size: 12pt; line-height: 1.5;">Here Open AI Codex identifies and applies the relevant MATLAB and radar-waveform-design skills. These skills do not contain a fixed answer to the problem. Instead, they provide the engineering process the agent should follow, including how to translate requirements into waveform parameters, evaluate design tradeoffs, and generate evidence that the final design meets its objectives.</p>
<p style="text-align: center;"><img decoding="async" src="https://blogs.mathworks.com/deep-learning/files/2026/10/04-agent-identifies-relevant-skill.png" class="alignnone size-full wp-image-19415" alt="AI Agent identified a relevant skill to apply" width="850" style="max-width: 100%; height: auto;" /></p>
<p style="text-align: center; font-style: italic; font-size: 12pt;">Figure 3: AI Agent identified a relevant skill to apply</p>
<p style="text-align: center;"><img decoding="async" src="https://blogs.mathworks.com/deep-learning/files/2026/10/05-agent-proposed-plan.png" class="alignnone size-full wp-image-19416" alt="Proposed plan from the AI Agent that uses MATLAB functions and System objects" width="850" style="max-width: 100%; height: auto;" /></p>
<p style="text-align: center; font-style: italic; font-size: 12pt;">Figure 4: Proposed plan from the AI Agent that uses MATLAB functions and System objects</p>
<p style="font-size: 12pt; line-height: 1.5;">Added a few more system requirements to characterize the targets:</p>
<blockquote style="background-color: #e2f0ff; border-left: 3px solid #0f4761; padding: 12px 16px; margin: 16px 0;"><p style="font-size: 12pt; line-height: 1.5;">Targets move up to 30 m/s. Maximum range of interest is 600 m.</p></blockquote>
<p style="text-align: center;"><img decoding="async" src="https://blogs.mathworks.com/deep-learning/files/2026/10/06-additional-system-requirements.png" class="alignnone size-full wp-image-19417" alt="Additional system requirements" width="850" style="max-width: 100%; height: auto;" /></p>
<p style="text-align: center; font-style: italic; font-size: 12pt;">Figure 5: Additional system requirements</p>
<p style="text-align: center;"><img decoding="async" src="https://blogs.mathworks.com/deep-learning/files/2026/10/07-agent-writes-runs-tests-script.png" class="alignnone size-full wp-image-19418" alt="AI Agent writes, runs and tests a MATLAB script" width="850" style="max-width: 100%; height: auto;" /></p>
<p style="text-align: center; font-style: italic; font-size: 12pt;">Figure 6: AI Agent writes, runs and tests a MATLAB script</p>
<p style="text-align: center;"><img decoding="async" src="https://blogs.mathworks.com/deep-learning/files/2026/10/08-matlab-waveform-results.png" class="alignnone size-full wp-image-19419" alt="Resultant MATLAB Plots - I/Q data, spectrum, pulse compression response and Doppler tolerance" width="850" style="max-width: 100%; height: auto;" /></p>
<p style="text-align: center; font-style: italic; font-size: 12pt;">Figure 7: Resultant MATLAB Plots - I/Q data, spectrum, pulse compression response and Doppler tolerance</p>
<p style="font-size: 12pt; line-height: 1.5;"><strong>The results.</strong> The four panels show that the waveform produced indeed meets all the stated requirements, so the agent was able to use the skill to create and run MATLAB code. The transmit spectrum shows the protected 100 MHz slice suppressed by more than 50 dB to avoid interference with the neighboring system. The pulse compression response puts the main lobe inside the 2 m range resolution requirement with peak sidelobes near 55 dB down, 15 dB better than what was required. The Doppler curve shows negligible loss of a few kHz at 30 m/s. </p>
<p style="font-size: 12pt; line-height: 1.5;"><strong>What the skill changed</strong>. Rather than leaving the AI agent to determine the process from scratch, the skill provided reliable, constraint-aware engineering guidance. It directed the agent to derive waveform parameters from the system requirements, select an appropriate spectral-shaping method, and verify the resulting design against resolution, sidelobe, and Doppler constraints. This produced a more repeatable and verifiable result <strong>without requiring the engineer to specify every design and validation step in the prompt.</strong> A two-attempt debugging limit also prevents the agent from entering unproductive loops and returns unresolved issues to the engineer for review and decision-making.</p>
<h2 style="font-size: 20pt; line-height: 1.25;">Teaching agents how engineers work</h2>
<p style="font-size: 12pt; line-height: 1.5;">This points to a more effective way for engineers to work with AI. <strong>Instead of encoding an entire procedure in every prompt,</strong> engineers can focus on requirements, constraints, and design decisions. Skills supply reusable engineering methods, agents carry out the workflow, and engineers review the evidence and make the final call.</p>
</div>]]></content:encoded>
					
					<wfw:commentRss>https://blogs.mathworks.com/deep-learning/2026/10/27/teaching-ai-agents-how-engineers-work/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Jump into Test Authoring Straight from Requirements Using an AI Agent</title>
		<link>https://blogs.mathworks.com/deep-learning/2026/10/13/jump-into-test-authoring-straight-from-requirements-using-an-ai-agent/?s_tid=feedtopost</link>
					<comments>https://blogs.mathworks.com/deep-learning/2026/10/13/jump-into-test-authoring-straight-from-requirements-using-an-ai-agent/#respond</comments>
		
		<dc:creator><![CDATA[Johanna Pingel]]></dc:creator>
		<pubDate>Tue, 13 Oct 2026 14:53:38 +0000</pubDate>
				<category><![CDATA[Deep Learning]]></category>
		<guid isPermaLink="false">https://blogs.mathworks.com/deep-learning/?p=19391</guid>

					<description><![CDATA[<div class="overview-image"><img  class="img-responsive" src="https://blogs.mathworks.com/deep-learning/files/2026/10/RequirementsMess.png" onError="this.style.display ='none';" /></div><p>





Guest writer: Pat Canny

Pat Canny is a Principal Technologist at MathWorks specializing in safety-critical systems development, Model-Based Design, and digital engineering workflows... <a class="read-more" href="https://blogs.mathworks.com/deep-learning/2026/10/13/jump-into-test-authoring-straight-from-requirements-using-an-ai-agent/">read more >></a></p>]]></description>
										<content:encoded><![CDATA[<div class="rtcContent">
<div>
<h6></h6>
<table style="background-color: #e2f0ff; margin-bottom: 18px;">
<tbody>
<tr>
<td style="vertical-align: middle; padding: 10px;"><strong>Guest writer: Pat Canny</strong>
<h6></h6>
<span style="font-weight: bold;">Pat Canny </span>is a Principal Technologist at MathWorks specializing in safety-critical systems development, Model-Based Design, and digital engineering workflows for aerospace and defense.</td>
</tr>
</tbody>
</table>
</div>
<div></div>
<div>
<div style="margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;">Authoring test cases is a tedious process. Authoring <em>good</em>, requirements-based, systematic test cases is… well it’s not always fun. When I created test cases to test my colleague’s designs in Simulink, the day-to-day requirements work often looked something like this:</div>
<div style="margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: center;"><img decoding="async" class="alignnone size-full wp-image-19398" style="vertical-align: baseline; max-width: 100%; height: auto;" src="https://blogs.mathworks.com/deep-learning/files/2026/10/RequirementsMess.png" alt="This reflects what day-to-day requirements work can feel like" width="850" /></div>
<div style="margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: italic; font-size: 13px; font-weight: 400; text-align: center;">This reflects what day-to-day requirements work can feel like.</div>
<div style="margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;">This is a time-consuming workflow, and I haven’t even talked about test coverage!</div>
<div style="margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;">This is an ideal use case for Agentic AI because an Agent can help “automate the boring stuff” and allow me, an engineer with domain expertise, to focus on authoring the <em>best</em> requirements-based test case possible while minimizing the context-switching between a text-based requirement and a Simulink model.</div>
<div style="margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;">To do this, I created a set of skill files in Codex which:</div>
<ul style="margin: 2px 10px 9px 24px; padding: 0px; line-height: 21px; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;">
<li>Analyzes a text-based requirement which follows EARS (Easy Approach to Requirements Syntax), a popular, structured methodology for writing requirements</li>
<li>Creates a human-reviewable “mapping” between “symbols” in the requirements text (e.g., “Enter Communications Mode”) and the Simulink model</li>
<li>Generates a test harness for the Simulink model with a draft test sequence as a source</li>
</ul>
<h2 style="margin: 22px 10px 8px 4px; padding: 0px; line-height: 25px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 20px; font-weight: bold; text-align: left;">A Short Demo</h2>
<div style="margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;">Here is what it looks like in action.</div>
<div style="margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: center;"><img decoding="async" class="alignnone size-full wp-image-19402" style="vertical-align: baseline; max-width: 100%; height: auto;" src="https://blogs.mathworks.com/deep-learning/files/2026/10/Req_to_Test_Sequence_Codex_Demo-1.gif" alt="" width="850" /></div>
<div style="margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: italic; font-size: 13px; font-weight: 400; text-align: center;">Demo of generating a draft Simulink Test sequence from requirements.</div>
<h2 style="margin: 22px 10px 8px 4px; padding: 0px; line-height: 25px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 20px; font-weight: bold; text-align: left;">What’s Inside</h2>
<div style="margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;">A set of skill files used for MATLAB and Simulink workflows typically includes a SKILL.md and a suite of MATLAB utility functions (*.m files). The SKILL.md defines the specialized workflow, instructions, and guardrails the agent should apply to a particular class of tasks. The MATLAB utility functions are invoked by the agent to perform specific, repeatable computations.</div>
<div style="margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;">For this use case, I created a SKILL.md and a suite of MATLAB utility functions specifically tailored for analyzing text-based requirements, creating a “mapping” between the text and the Simulink model under test, and for creating a test sequence within a test harness (<a href="https://github.com/matlab/agent-skills-playground/tree/main/skills/simulink-test-sequence-from-ears" target="_blank" rel="noopener">available on GitHub</a>).</div>
<div style="margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;">The SKILL.md includes a brief name and a description:</div>
<pre class="not_code" style="margin: 2px 10px 9px 4px; padding: 10px; line-height: 19px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Consolas, 'Courier New', monospace; font-style: normal; font-size: 13px; font-weight: 400; text-align: left; background-color: #f5f5f5;">---
name: simulink-test-sequence-from-EARS
description: Generate Simulink Test Sequences from EARS-compliant requirements. Use when creating test cases from EARS requirements, generating Test Sequence blocks from .slreqx files, or testing Simulink models against text-based requirements.
---</pre>
<div style="margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;">The SKILL.md also includes sections that describe:</div>
<ul style="margin: 2px 10px 9px 24px; padding: 0px; line-height: 21px; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;">
<li><strong>Goal:</strong> What the skill is intended to accomplish.</li>
<li><strong>Supported “EARS” patterns:</strong> Which requirement formats the skill can process.</li>
<li><strong>Inputs Required:</strong> What files and context the agent needs.</li>
<li><strong>Triggering phrases:</strong> Example prompts that invoke the skill.</li>
<li><strong>Setup:</strong> Dependencies and project configuration.</li>
<li><strong>Workflow:</strong> The steps the agent follows.</li>
</ul>
<div style="margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;">The workflow is broken up into two phases. I’ll use a simple example to explain.</div>
<div style="margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;">Let’s say I have requirements for a quadcopter’s flight mode logic. These requirements follow the “EARS” syntax. Here’s a snippet of the “Establish Communications Mode” requirements from Requirements Toolbox:</div>
<div style="margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: center;"><img decoding="async" class="alignnone size-full wp-image-19393" style="vertical-align: baseline; max-width: 100%; height: auto;" src="https://blogs.mathworks.com/deep-learning/files/2026/10/image1.png" alt="Requirements Toolbox snippet of Establish Communications Mode requirements" width="850" /></div>
<div style="margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: italic; font-size: 13px; font-weight: 400; text-align: center;">Requirements Toolbox snippet of the “Establish Communications Mode” requirements.</div>
<div style="margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;">I want to write a set of requirements-based tests against this Stateflow state chart:</div>
<div style="margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: center;"><img decoding="async" class="alignnone size-full wp-image-19394" style="vertical-align: baseline; max-width: 100%; height: auto;" src="https://blogs.mathworks.com/deep-learning/files/2026/10/image2.png" alt="Stateflow state chart for quadcopter flight mode logic" width="850" /></div>
<div style="margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: italic; font-size: 13px; font-weight: 400; text-align: center;">Stateflow state chart for the quadcopter flight mode logic.</div>
<div style="margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;">A quick note on what I mean by “requirements-based tests.” This type of testing ensures the intent of the requirement (the expected behavior) is being met by the design. For this specific example, I want to ensure that the quadcopter is commanded to enter the correct mode based on the conditions.</div>
<div style="margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;">Requirements-based testing differs from workflows like “robustness testing,” which is when I’d try to deliberately “break” the design by injecting faults, attacks, or anything along those lines which go beyond just the “if this, then that” type of test cases. Requirements-based tests are the “first line of defense” and can also help ensure you have the right set of requirements to begin with before diving into robustness testing.</div>
<div style="margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;">OK, back to the workflow!</div>
<div style="margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;">Phase 1 starts by reading requirements from a Requirements Set (*.slreqx file), then inspecting the Simulink model before creating a .yaml file containing the “mapping” of text elements for each requirement to an element in the Simulink model. For example, the term “Establish Communication” corresponds to the “WaitForComms” state in the Simulink model’s Stateflow state chart. I need to approve this “mapping” artifact (.yaml file) before the agent can proceed.</div>
<div style="margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: center;"><img decoding="async" class="alignnone size-full wp-image-19395" style="vertical-align: baseline; max-width: 100%; height: auto;" src="https://blogs.mathworks.com/deep-learning/files/2026/10/image3.png" alt="Mapping artifact connecting requirements text to Simulink model elements" width="850" /></div>
<div style="margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: italic; font-size: 13px; font-weight: 400; text-align: center;">Mapping artifact connecting requirements text to Simulink model elements.</div>
<div style="margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;">Phase 2 begins once I approve the “mapping” between the requirements text and the Simulink model elements. The mapping is used to generate a test harness using Simulink Test, which isolates the Simulink model for testing, as well as a corresponding draft Test Sequence, which is a stepwise test source. The Test Sequence is then opened for me to inspect and modify.</div>
<div style="margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: center;"><img decoding="async" class="alignnone size-full wp-image-19396" style="vertical-align: baseline; max-width: 100%; height: auto;" src="https://blogs.mathworks.com/deep-learning/files/2026/10/image4.png" alt="Generated Simulink Test harness and draft Test Sequence" width="850" /></div>
<div style="margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: italic; font-size: 13px; font-weight: 400; text-align: center;">Generated Simulink Test harness and draft Test Sequence.</div>
<h2 style="margin: 22px 10px 8px 4px; padding: 0px; line-height: 25px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 20px; font-weight: bold; text-align: left;">Why This Matters</h2>
<div style="margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;">AI agents, like any tool, have their strengths and weaknesses. One of their strengths is their ability to translate between different levels of abstraction, such as a text-based requirement and a Simulink model. But AI agents are not trained in every engineering domain, which is where you come in. Skill files allow you to leverage the strengths of AI agents while validating the agent’s outputs along the way through human-readable artifacts.</div>
<h2 style="margin: 22px 10px 8px 4px; padding: 0px; line-height: 25px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 20px; font-weight: bold; text-align: left;">Try It Yourself</h2>
<div style="margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;">You will need MATLAB R2023a or newer with Simulink, Stateflow, Requirements Toolbox, and Simulink Test installed. You will also need the skill files (<a href="https://github.com/matlab/agent-skills-playground/tree/main/skills/simulink-test-sequence-from-ears" target="_blank" rel="noopener">available here</a>) and Simulink Agentic Toolkit installed. Simulink Agentic Toolkit includes MATLAB MCP Server, which is required for Agentic AI workflows with Simulink. I tested the skill files using Codex, but the setup should be straightforward to port to other coding agents.</div>
<div style="margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;">Drop the skill folder into your project’s /skills/ directory, start the agent, and invoke the Skill using a phrase like “create test cases for the requirements in mode_logic.slreqx”.</div>
<div style="margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;">We’re always looking for insights into your challenges in testing your Simulink designs, so please leave a comment below!</div>
</div>
</div>
]]></content:encoded>
					
					<wfw:commentRss>https://blogs.mathworks.com/deep-learning/2026/10/13/jump-into-test-authoring-straight-from-requirements-using-an-ai-agent/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>From Differential Equations to Data: Exploring Inverse Problems with PINNLab</title>
		<link>https://blogs.mathworks.com/deep-learning/2026/09/15/from-differential-equations-to-data-exploring-inverse-problems-with-pinnlab/?s_tid=feedtopost</link>
					<comments>https://blogs.mathworks.com/deep-learning/2026/09/15/from-differential-equations-to-data-exploring-inverse-problems-with-pinnlab/#respond</comments>
		
		<dc:creator><![CDATA[Johanna Pingel]]></dc:creator>
		<pubDate>Tue, 15 Sep 2026 14:07:50 +0000</pubDate>
				<category><![CDATA[Deep Learning]]></category>
		<guid isPermaLink="false">https://blogs.mathworks.com/deep-learning/?p=19374</guid>

					<description><![CDATA[<div class="overview-image"><img  class="img-responsive" src="https://blogs.mathworks.com/deep-learning/files/2026/09/Figure-1-PINNLab-Blog.png" onError="this.style.display ='none';" /></div><p>







Guest writers: Mohan Parthasarathy and Padmanabhan Seshaiyer, PhD

Mohan Parthasarathy is a student at Thomas Jefferson High School for Science and Technology. Padmanabhan... <a class="read-more" href="https://blogs.mathworks.com/deep-learning/2026/09/15/from-differential-equations-to-data-exploring-inverse-problems-with-pinnlab/">read more >></a></p>]]></description>
										<content:encoded><![CDATA[<div class="rtcContent">
<div>
<div style="margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;"></div>
<div>
<h6></h6>
<table style="background-color: #e2f0ff;">
<tbody>
<tr>
<td style="vertical-align: middle; padding: 10px;"><strong>Guest writers: <a href="http://www.linkedin.com/in/mohanparthasarathy27" target="_blank" rel="noopener">Mohan Parthasarathy</a> and <a href="https://math.gmu.edu/~pseshaiy/" target="_blank" rel="noopener">Padmanabhan Seshaiyer, PhD</a></strong>
<h6></h6>
<span style="font-weight: bold;">Mohan Parthasarathy </span>is a student at Thomas Jefferson High School for Science and Technology. <span style="font-weight: bold;">Padmanabhan Seshaiyer, PhD, </span>is Professor of Mathematics at George Mason University.</td>
</tr>
</tbody>
</table>
<h6></h6>
</div>
<div style="margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;"></div>
</div>
<div></div>
<div>
<div style="margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;">In this blog post, we discuss PINNLab, an interactive MATLAB application for exploring parameter estimation in differential equation models using physics-informed neural networks (PINNs).</div>
<h2 style="margin: 3px 10px 5px 4px; padding: 0px; line-height: 25px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 20px; font-weight: bold; text-align: left;">The Inverse Problem</h2>
<div style="margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;">Many scientific and engineering problems require working backward from limited observations to understand the system that produced them. Suppose you know the equations governing a population, an epidemic, or a chemical process, but not the growth rate, transmission rate, or reaction constant. Given a small collection of noisy measurements, how can you recover those missing parameters?</div>
<div style="margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;">This is an inverse problem: working backward from observations to infer the parameters that produced them. We built PINNLab to make that process interactive. Users choose a model, provide observations, train a physics-informed neural network, and examine whether it recovers both the system trajectory and its hidden parameters.</div>
<div style="margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;"><img decoding="async" class="imageNode alignnone size-full wp-image-19377" style="vertical-align: baseline; max-width: 100%; height: auto;" src="https://blogs.mathworks.com/deep-learning/files/2026/09/Figure-1-PINNLab-Blog.png" alt="PINNLab interface for configuring and solving inverse problems" width="850" /></div>
<div style="margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: italic; font-size: 13px; font-weight: 400; text-align: center;">Figure 1. The PINNLab interface for configuring and solving inverse problems.</div>
<h2 style="margin: 3px 10px 5px 4px; padding: 0px; line-height: 25px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 20px; font-weight: bold; text-align: left;">What Makes a PINN Different?</h2>
<div style="margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;">A standard neural network learns by fitting observed data. A physics-informed neural network, or PINN, learns from both the data and the governing equations describing the system.</div>
<div style="margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;">For an ODE, the network approximates the system state <em>x(t)</em>, while automatic differentiation provides its derivative. Training balances data fit, the differential equation residual, and the initial conditions, while estimating the unknown parameters &theta;.</div>
<div style="margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: center;"><img decoding="async" src="https://blogs.mathworks.com/deep-learning/files/2026/09/Figure2_modified.png" alt="" class="aligncenter wp-image-19383" width="765" style="vertical-align: baseline; width: 765px; max-width: 90%; height: auto;" /></div>
<div style="margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: italic; font-size: 13px; font-weight: 400; text-align: center;">Figure 2. How a PINN combines data and governing equations during training.</div>
<div style="margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;">This does not mean PINNs replace numerical methods. Conventional optimization may be faster for small, well-identified models. PINNs become especially interesting when data are sparse, some states are hidden, or states and parameters must be reconstructed together. PINNLab helps users explore that tradeoff rather than assume the PINN will always win.</div>
<h2 style="margin: 3px 10px 5px 4px; padding: 0px; line-height: 25px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 20px; font-weight: bold; text-align: left;">Why We Built PINNLab</h2>
<div style="margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;">Most differential equations courses focus on forward problems: you are given the equation and parameters, and your job is to solve for the state.</div>
<div style="margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;">Research rarely works that way. More often, you have the equations and data, but the parameters are exactly what you are trying to discover. That drew us to inverse problems and, eventually, PINNs.</div>
<div style="margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;">As we experimented, we kept rebuilding the same pieces: physics residuals, custom training loops, trajectory plots, and parameter comparisons. Many examples we encountered were research-oriented Python implementations: useful for reproducing results, but not designed for students to change assumptions and see why the model behaved as it did. Eventually we realized something had changed. We were not just building models anymore; we were building a learning environment, one we found equally useful for rapidly prototyping and testing inverse problem workflows during research.</div>
<div style="margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;">PINNLab grew from the questions that kept coming up: Where does the network get its information? What happens when data become sparse? When does the differential equation help? MATLAB gave us a natural way to bring those questions into one place. Deep Learning Toolbox handles automatic differentiation and custom training, while App Designer puts the mathematics, controls, and visual feedback into an interactive app.</div>
<h2 style="margin: 3px 10px 5px 4px; padding: 0px; line-height: 25px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 20px; font-weight: bold; text-align: left;">Learning by Building the Model</h2>
<div style="margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;">PINNLab follows the 5E instructional framework: Engage, Explore, Explain, Elaborate, and Evaluate. Learners begin with a scientific question, experiment with a simpler system, and gradually build the mathematics needed to address it.</div>
<div style="margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;">We also drew on the <a href="https://www.dol.gov/newsroom/releases/eta/eta20260213" target="_blank" rel="noopener">U.S. Department of Labor's AI Literacy Framework</a>, which emphasizes understanding what AI can and cannot do, evaluating its outputs, and keeping human judgment central. In PINNLab, learners do more than click Train: they are encouraged to experiment. What happens if you remove half the observations? What if you estimate six parameters instead of two? What if the governing equation is slightly wrong? PINNLab lets users change those assumptions and immediately see how the trajectories, residuals, and parameter estimates respond. The goal is not simply a low loss, but an understanding of why the model succeeded or failed.</div>
<div style="margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;">In that sense, PINNLab becomes more than a PINN implementation. It is a place to see how inverse problems behave, making machine learning more accessible and helping users develop the judgment needed to apply AI responsibly in scientific work.</div>
<h2 style="margin: 3px 10px 5px 4px; padding: 0px; line-height: 25px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 20px; font-weight: bold; text-align: left;">Estimating Predator-Prey Parameters</h2>
<div style="margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;">PINNLab's current curriculum follows an ecological storyline centered on Canadian snowshoe hares and lynx. Open the app, choose the Lotka-Volterra predator-prey model, select which parameters the network should learn, and import or generate observations. When you click Train, the PINN reconstructs both populations while estimating the ecological parameters.</div>
<div style="margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;"><img decoding="async" class="imageNode alignnone size-full wp-image-19379" style="vertical-align: baseline; max-width: 100%; height: auto;" src="https://blogs.mathworks.com/deep-learning/files/2026/09/Figure-3-PINNLab-Blog.gif" alt="PINNLab parameter estimation workflow with changing observations and retraining" width="850" /></div>
<div style="margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: italic; font-size: 13px; font-weight: 400; text-align: center;">Figure 3. Exploring parameter estimation by changing observations and retraining the PINN.</div>
<div style="margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;">During training, the network weights and ecological parameters are optimized simultaneously. Once training finishes, PINNLab reports the recovered parameter values alongside their initial guesses and, when the true values are known, their relative errors. The curriculum then introduces logistic prey growth and a Holling Type II functional response, creating a six-parameter inverse problem.</div>
<div style="margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;">The table below shows one result for the Holling Type II model.</div>
<table style="margin: 3px; border: 0.666667px solid #bfbfbf; border-collapse: collapse;">
<tbody>
<tr style="background-color: #f5f5f5;">
<td style="border: 0.666667px solid #bfbfbf; vertical-align: top;"><div style="margin: 2px 10px 2px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: break-spaces; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 700; text-align: left;">Parameter</div></td>
<td style="border: 0.666667px solid #bfbfbf; vertical-align: top;"><div style="margin: 2px 10px 2px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: break-spaces; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 700; text-align: left;">True Value</div></td>
<td style="border: 0.666667px solid #bfbfbf; vertical-align: top;"><div style="margin: 2px 10px 2px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: break-spaces; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 700; text-align: left;">Initial Guess</div></td>
<td style="border: 0.666667px solid #bfbfbf; vertical-align: top;"><div style="margin: 2px 10px 2px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: break-spaces; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 700; text-align: left;">Estimated Value</div></td>
<td style="border: 0.666667px solid #bfbfbf; vertical-align: top;"><div style="margin: 2px 10px 2px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: break-spaces; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 700; text-align: left;">Relative Error (%)</div></td>
</tr>
<tr><td style="border: 0.666667px solid #bfbfbf; vertical-align: top;"><div style="margin: 2px 10px 2px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: break-spaces; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;">&alpha;</div></td><td style="border: 0.666667px solid #bfbfbf; vertical-align: top;"><div style="margin: 2px 10px 2px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: break-spaces; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;">1.0000</div></td><td style="border: 0.666667px solid #bfbfbf; vertical-align: top;"><div style="margin: 2px 10px 2px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: break-spaces; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;">0.9000</div></td><td style="border: 0.666667px solid #bfbfbf; vertical-align: top;"><div style="margin: 2px 10px 2px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: break-spaces; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;">0.9471</div></td><td style="border: 0.666667px solid #bfbfbf; vertical-align: top;"><div style="margin: 2px 10px 2px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: break-spaces; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;">5.29</div></td></tr>
<tr><td style="border: 0.666667px solid #bfbfbf; vertical-align: top;"><div style="margin: 2px 10px 2px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: break-spaces; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;">K (carrying capacity)</div></td><td style="border: 0.666667px solid #bfbfbf; vertical-align: top;"><div style="margin: 2px 10px 2px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: break-spaces; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;">50.0000</div></td><td style="border: 0.666667px solid #bfbfbf; vertical-align: top;"><div style="margin: 2px 10px 2px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: break-spaces; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;">45.0000</div></td><td style="border: 0.666667px solid #bfbfbf; vertical-align: top;"><div style="margin: 2px 10px 2px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: break-spaces; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;">50.8846</div></td><td style="border: 0.666667px solid #bfbfbf; vertical-align: top;"><div style="margin: 2px 10px 2px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: break-spaces; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;">1.77</div></td></tr>
<tr><td style="border: 0.666667px solid #bfbfbf; vertical-align: top;"><div style="margin: 2px 10px 2px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: break-spaces; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;">&beta;</div></td><td style="border: 0.666667px solid #bfbfbf; vertical-align: top;"><div style="margin: 2px 10px 2px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: break-spaces; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;">2.2000</div></td><td style="border: 0.666667px solid #bfbfbf; vertical-align: top;"><div style="margin: 2px 10px 2px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: break-spaces; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;">2.0000</div></td><td style="border: 0.666667px solid #bfbfbf; vertical-align: top;"><div style="margin: 2px 10px 2px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: break-spaces; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;">2.5492</div></td><td style="border: 0.666667px solid #bfbfbf; vertical-align: top;"><div style="margin: 2px 10px 2px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: break-spaces; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;">15.87</div></td></tr>
<tr><td style="border: 0.666667px solid #bfbfbf; vertical-align: top;"><div style="margin: 2px 10px 2px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: break-spaces; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;">c (half-saturation constant)</div></td><td style="border: 0.666667px solid #bfbfbf; vertical-align: top;"><div style="margin: 2px 10px 2px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: break-spaces; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;">8.0000</div></td><td style="border: 0.666667px solid #bfbfbf; vertical-align: top;"><div style="margin: 2px 10px 2px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: break-spaces; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;">9.0000</div></td><td style="border: 0.666667px solid #bfbfbf; vertical-align: top;"><div style="margin: 2px 10px 2px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: break-spaces; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;">7.0448</div></td><td style="border: 0.666667px solid #bfbfbf; vertical-align: top;"><div style="margin: 2px 10px 2px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: break-spaces; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;">11.94</div></td></tr>
<tr><td style="border: 0.666667px solid #bfbfbf; vertical-align: top;"><div style="margin: 2px 10px 2px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: break-spaces; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;">&gamma;</div></td><td style="border: 0.666667px solid #bfbfbf; vertical-align: top;"><div style="margin: 2px 10px 2px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: break-spaces; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;">0.7000</div></td><td style="border: 0.666667px solid #bfbfbf; vertical-align: top;"><div style="margin: 2px 10px 2px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: break-spaces; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;">0.6000</div></td><td style="border: 0.666667px solid #bfbfbf; vertical-align: top;"><div style="margin: 2px 10px 2px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: break-spaces; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;">0.7899</div></td><td style="border: 0.666667px solid #bfbfbf; vertical-align: top;"><div style="margin: 2px 10px 2px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: break-spaces; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;">12.84</div></td></tr>
<tr><td style="border: 0.666667px solid #bfbfbf; vertical-align: top;"><div style="margin: 2px 10px 2px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: break-spaces; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;">&delta;</div></td><td style="border: 0.666667px solid #bfbfbf; vertical-align: top;"><div style="margin: 2px 10px 2px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: break-spaces; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;">0.9000</div></td><td style="border: 0.666667px solid #bfbfbf; vertical-align: top;"><div style="margin: 2px 10px 2px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: break-spaces; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;">0.8000</div></td><td style="border: 0.666667px solid #bfbfbf; vertical-align: top;"><div style="margin: 2px 10px 2px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: break-spaces; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;">0.8040</div></td><td style="border: 0.666667px solid #bfbfbf; vertical-align: top;"><div style="margin: 2px 10px 2px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: break-spaces; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;">10.67</div></td></tr>
</tbody>
</table>
<div style="margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: italic; font-size: 13px; font-weight: 400; text-align: center;">Table 1. Recovered parameter estimates for the logistic-growth Holling Type II predator-prey model.</div>
<div style="margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;">The estimates recover the overall parameter scale, although some parameters are identified more accurately than others. Differences like these help learners see that parameter recovery depends not only on training performance, but also on how strongly each parameter is identified by the available observations.</div>
<div style="margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;">The six-parameter inverse problem raises a natural question: How many parameters can a PINN estimate at once? There is no universal answer. It depends on the information in the data, parameter identifiability, and model quality. In several PINNLab experiments, we were able to estimate as many as eight unknown parameters, although accuracy depended heavily on the model and data. But as the number increased, the problem quickly became one of identifiability, not just computation. That is exactly what we want learners to discover.</div>
<div style="margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;">Finally, learners upload historical Hudson's Bay Company hare-lynx records and compare competing models against real data.</div>
<div style="margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;"><img decoding="async" class="imageNode alignnone size-full wp-image-19380" style="vertical-align: baseline; max-width: 100%; height: auto;" src="https://blogs.mathworks.com/deep-learning/files/2026/09/Figure-4-PINNLab-Blog.png" alt="PINNLab comparison of competing predator-prey models using historical hare-lynx observations" width="850" /></div>
<div style="margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: italic; font-size: 13px; font-weight: 400; text-align: center;">Figure 4. Comparing competing predator-prey models using historical hare-lynx observations.</div>
<h2 style="margin: 3px 10px 5px 4px; padding: 0px; line-height: 25px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 20px; font-weight: bold; text-align: left;">What Surprised Us</h2>
<div style="margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;">Before building PINNLab, we assumed that if a network reproduced the observed data, it must also have learned the correct parameters. Inverse problems taught us otherwise: an accurate-looking trajectory does not guarantee accurate parameters.</div>
<div style="margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;">A network may fit the observations while compensating for an incorrect parameter elsewhere in the model. Conversely, a physics residual that refuses to converge may reveal that the governing equation itself is inconsistent with the data.</div>
<div style="margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;">That is not necessarily an algorithmic failure. It may be evidence that the model needs to change.</div>
<div style="margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;">This distinction between fitting data and validating a scientific explanation became one of PINNLab's most valuable teaching features.</div>
<h2 style="margin: 3px 10px 5px 4px; padding: 0px; line-height: 25px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 20px; font-weight: bold; text-align: left;">Where We're Taking PINNLab Next</h2>
<div style="margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;">Once PINNLab worked well for ecology, the next question was: Where else can this idea go? We are now expanding the platform toward disease dynamics, contaminant transport, hemodynamics, and pharmacological modeling. We are also interested in exploring how PINNs fit within the broader modeling ecosystem, including established parameter-estimation workflows such as those available in <a href="https://www.mathworks.com/help/simbio/ug/supported-methods-for-parameter-estimation.html" target="_blank" rel="noopener">SimBiology</a>.</div>
<div style="margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;">We are in the process of adding guided modules, stronger diagnostics, and support for more complex parameters. Our goal is not to make every problem look like a PINN problem, but to help users recognize when physics-informed learning adds value.</div>
<h2 style="margin: 3px 10px 5px 4px; padding: 0px; line-height: 25px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 20px; font-weight: bold; text-align: left;">Try PINNLab</h2>
<div style="margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;">We built PINNLab because inverse problems deserve the same kind of interactive learning environments that already exist for solving differential equations. Physics-informed neural networks can combine mathematical models with observational data, but understanding when they work is just as important as knowing how to run them.</div>
<div style="margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;">We hope PINNLab gives you a place not only to train a PINN, but to ask the more important questions: What did the network actually learn? Why should you trust it? And what does the governing equation contribute that the data alone cannot?</div>
<div style="margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;">Let us know in the comments what kinds of inverse problems you'd most like to explore with PINNLab. Check out the <a href="https://github.com/mohanparthasarathy/PINNLab/tree/main" target="_blank" rel="noopener">open-source PINNLab code and examples on GitHub</a> and read our accompanying <a href="https://scholarship.claremont.edu/codee/vol20/iss2/5" target="_blank" rel="noopener">CODEE Journal article</a>.</div>
</div>
</div>
]]></content:encoded>
					
					<wfw:commentRss>https://blogs.mathworks.com/deep-learning/2026/09/15/from-differential-equations-to-data-exploring-inverse-problems-with-pinnlab/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Developing MRI Reconstruction Workflows in MATLAB: From k-Space to AI-Based Methods</title>
		<link>https://blogs.mathworks.com/deep-learning/2026/08/06/developing-mri-reconstruction-workflows-in-matlab-from-k-space-to-ai-based-methods/?s_tid=feedtopost</link>
		
		<dc:creator><![CDATA[Johanna Pingel]]></dc:creator>
		<pubDate>Thu, 06 Aug 2026 14:25:08 +0000</pubDate>
				<category><![CDATA[Deep Learning]]></category>
		<guid isPermaLink="false">https://blogs.mathworks.com/deep-learning/?p=19354</guid>

					<description><![CDATA[<div class="overview-image"><img  class="img-responsive" src="https://blogs.mathworks.com/deep-learning/files/2026/08/MRI_k_space_nutshell.png" onError="this.style.display ='none';" /></div><p>
The following post is from Sagar Hukkire, Senior Application Engineer at MathWorks, and Visa Suomi, Medical Devices Industry Manager.
Magnetic Resonance Imaging (MRI) reconstruction plays a... <a class="read-more" href="https://blogs.mathworks.com/deep-learning/2026/08/06/developing-mri-reconstruction-workflows-in-matlab-from-k-space-to-ai-based-methods/">read more >></a></p>]]></description>
										<content:encoded><![CDATA[<div class="rtcContent">
<div style="margin: 2px 10px 14px 4px; padding: 0px; line-height: 22px; min-height: 0px; white-space: pre-wrap; color: #4a4a4a; font-family: Georgia, 'Times New Roman', serif; font-style: italic; font-size: 15px; font-weight: 400; text-align: left;">The following post is from Sagar Hukkire, Senior Application Engineer at MathWorks, and Visa Suomi, Medical Devices Industry Manager.</div>
<div style="margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;">Magnetic Resonance Imaging (MRI) reconstruction plays a critical role in transforming raw scanner data (in the frequency domain, known as k-space) into clinically usable images. In the examples shown here, we use low-SNR input k-space data from a T1-weighted MRI modality, which makes robust reconstruction especially important.</div>
<div style="margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;">Building a scalable, flexible MRI reconstruction workflow that supports experimentation, acceleration, and deployment is a challenging but increasingly important task as MRI datasets continue to grow in size, advanced reconstruction methods such as compressed sensing and deep learning become more prevalent, and the demand for faster, higher-quality imaging in both research and clinical environments continues to increase.</div>
<div style="margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;">In this blog post, we present an end-to-end MRI reconstruction pipeline implemented in MATLAB&reg; that combines classical physics-based techniques with modern AI methods. The workflow integrates three complementary approaches:</div>
<ul style="margin: 10px 0px 20px; padding-left: 0px; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-size: 14px;">
  <li style="margin-left: 56px; line-height: 21px; min-height: 0px; text-align: left; white-space: pre-wrap;">Inverse FFT (IFFT) &ndash; a baseline reconstruction using the inverse fast Fourier transform on fully sampled data.</li>
  <li style="margin-left: 56px; line-height: 21px; min-height: 0px; text-align: left; white-space: pre-wrap;">Compressed Sensing (CS) with wavelets &ndash; an accelerated reconstruction using undersampled data and sparse-signal recovery.</li>
  <li style="margin-left: 56px; line-height: 21px; min-height: 0px; text-align: left; white-space: pre-wrap;">Deep Learning with a U-Net &ndash; a data-driven reconstruction that learns to restore high-quality images from undersampled data.</li>
</ul>
<div style="margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;">These techniques are realized in MATLAB and support GPU acceleration, enabling rapid prototyping and easy transition to deployment via automated code generation with IEC 62304 certification support. By blending tried-and-true signal processing methods with AI-based approaches, we can achieve high-quality MRI images with shorter scan times and maintain a smooth path from R&amp;D to production.</div>
<div style="margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;"><img decoding="async" class="alignnone size-full wp-image-19358" style="vertical-align: baseline; max-width: 100%; height: auto;" src="https://blogs.mathworks.com/deep-learning/files/2026/08/MRI_k_space_nutshell.png" alt="MRI k-space in a nutshell" width="850" /></div>
<div style="margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: italic; font-size: 13px; font-weight: 400; text-align: center;">MRI k-space in a nutshell &ndash; an MRI scanner uses controlled RF &amp; gradient pulses to fill k-space (frequency data). The inverse 2D FFT then produces the final image. Efficient reconstruction must balance scan time, image quality, and compute cost.</div>
<h2 style="margin: 3px 10px 5px 4px; padding: 0px; line-height: 25px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 20px; font-weight: bold; text-align: left;">Why Combine Multiple Reconstruction Approaches?</h2>
<div style="margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;">MRI reconstruction involves trade-offs between acquisition speed, image resolution, and artifact suppression. Traditionally, collecting a fully sampled k-space grid and applying an IFFT yields a high-quality image with minimal aliasing. However, fully sampling k-space is time-consuming, which can prolong scan durations for patients and reduce scanner throughput in busy clinical environments. Modern methods speed up scans by undersampling k-space, but a basic IFFT of undersampled data produces artifacts such as aliasing and blurring that can limit diagnostic quality. More advanced computational techniques are therefore needed to reconstruct images from incomplete data.</div>
<div style="margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;">Instead of betting on a single &ldquo;silver bullet&rdquo; algorithm, our MATLAB workflow incorporates multiple reconstruction strategies in one environment. This approach lets you:</div>
<ul style="margin: 10px 0px 20px; padding-left: 0px; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-size: 14px;">
  <li style="margin-left: 56px; line-height: 21px; min-height: 0px; text-align: left; white-space: pre-wrap;">Establish a reliable baseline: The IFFT method provides ground-truth reconstruction on full data. We use it to validate our pipeline and as a quality benchmark.</li>
  <li style="margin-left: 56px; line-height: 21px; min-height: 0px; text-align: left; white-space: pre-wrap;">Explore accelerated acquisitions: Compressed sensing (CS) allows scanning with fewer k-space samples and reconstructs images by leveraging sparsity &ndash; cutting scan time significantly at the cost of computational effort.</li>
  <li style="margin-left: 56px; line-height: 21px; min-height: 0px; text-align: left; white-space: pre-wrap;">Leverage AI for improvements: Deep learning with a U-Net network architecture can further enhance reconstruction quality or speed by learning from data, reducing residual artifacts and possibly enabling even faster acquisitions without sacrificing image fidelity.</li>
</ul>
<div style="margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;">By unifying all three methods in MATLAB, you get the flexibility to switch or combine approaches as needed. For example, you might start from the IFFT baseline and then compare it to a CS reconstruction or use a deep network to refine a physics-based output. And because these solutions share a common environment, it&rsquo;s straightforward to integrate them with common tasks like visualization, image post-processing, and deployment.</div>
<h2 style="margin: 3px 10px 5px 4px; padding: 0px; line-height: 25px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 20px; font-weight: bold; text-align: left;">Baseline Reconstruction with Inverse FFT (IFFT)</h2>
<div style="margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;">We begin with the simplest case: fully sampled k-space data. If all required frequency samples have been acquired, reconstructing an image is as direct as performing a 2D inverse Fourier transform. In MATLAB, we can do this with a few lines of code (including coil combination if multiple receiver coils are used):</div>
<pre class="codeinput"><span class="comment">% Read complex k-space data from HDF5 file</span>
kspaceData = h5read(filePath, datasetPath);

<span class="comment">% Move the zero-frequency component from the center to the corners</span>
<span class="comment">% (undo the scanner/vendor-specific k-space centering)</span>
kspaceShifted = ifftshift(ifftshift(kspaceData, 1), 2);

<span class="comment">% Construct a complex-valued k-space matrix from real and imaginary parts</span>
kspace = complex(kspaceShifted.r, kspaceShifted.i);

<span class="comment">% Perform 2-D inverse Fourier transform to reconstruct coil images</span>
imageC = ifft2(double(kspace));

<span class="comment">% Shift reconstructed images so that the image center appears in the middle</span>
imageC = fftshift(fftshift(imageC, 1), 2);

<span class="comment">% Combine multiple receiver coils using Root-Sum-of-Squares (RSS)</span>
<span class="comment">% Coil dimension is assumed to be the 3rd dimension</span>
reconImage = sqrt(sum(abs(imageC).^2, 3));

<span class="comment">% Remove singleton dimensions to obtain the final image matrix</span>
reconImage = squeeze(reconImage);
imshow(abs(gather(reconImage)), []);              <span class="comment">% display magnitude image</span></pre>
<div style="margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;">This baseline IFFT reconstruction is fast, deterministic, and rooted in the physics of MRI. With fully sampled data, it produces a high-quality image that can serve as our reference. However, the need to capture all of k-space means long scan times in practice. Next, we look at how to get good images faster by collecting less data and using smarter reconstruction algorithms.</div>
<h2 style="margin: 3px 10px 5px 4px; padding: 0px; line-height: 25px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 20px; font-weight: bold; text-align: left;">Compressed Sensing: Faster Scans with Sparse Reconstruction</h2>
<div style="margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;">Compressed Sensing (CS) is a technique that enables accurate reconstructions from significantly fewer samples by exploiting sparsity in some transform domain. For MRI, a common approach is to assume the image has a sparse representation in the wavelet domain. By undersampling k-space (skipping many phase-encode lines), we speed up acquisition; then, an iterative algorithm recovers the image by enforcing wavelet sparsity and consistency with the measured data.</div>
<div style="margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;">In our workflow&rsquo;s CS example, we simulate an undersampled acquisition (e.g., retaining 25% of the original k-space points in a variable-density random pattern). The reconstruction uses an iterative refine-and-threshold algorithm:</div>
<pre class="codeinput"><span class="comment">% Initialize storage for compressed sensing reconstructions</span>
im_cs = zeros(size(kspace_data));

<span class="comment">% Reconstruct each coil and frame independently</span>
for frame = 1:num_frames
    for coil = 1:num_coils

        <span class="comment">% Apply undersampling mask in k-space</span>
        undersampled_data = kspace_data(:,:,coil,frame) .* mask_vardens;

        <span class="comment">% Initial image reconstruction from undersampled data</span>
        im_cs(:,:,coil,frame) = ifft2s(undersampled_data);

        <span class="comment">% Apply coil sensitivity map</span>
        im_cs(:,:,coil,frame) = ...
            im_cs(:,:,coil,frame) .* coilSensitivityMaps(:,:,coil,frame);

        <span class="comment">% POCS-based compressed sensing reconstruction</span>
        for iter = 1:num_iters

            <span class="comment">% Transform to wavelet domain and enforce sparsity</span>
            [C, S] = wavedec2(im_cs(:,:,coil,frame), 2, 'db1');
            C_thresh = wthresh(C, 's', threshold);
            im_cs(:,:,coil,frame) = waverec2(C_thresh, S, 'db1');

            <span class="comment">% Enforce k-space data consistency</span>
            kspace_estimate = fft2s(im_cs(:,:,coil,frame));
            kspace_estimate(mask_vardens) = ...
                undersampled_data(mask_vardens);

            <span class="comment">% Update image estimate</span>
            im_cs(:,:,coil,frame) = ifft2s(kspace_estimate);
        end
    end
end

<span class="comment">% Combine all coils using Root-Sum-of-Squares (RSS)</span>
rss_CSimage = sqrt(sum(abs(im_cs).^2, 3));

<span class="comment">% Remove singleton dimensions</span>
rss_CSimage = squeeze(rss_CSimage);</pre>
<div style="margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;">How it works: The loop alternates between enforcing measured data (swapping in the acquired k-space lines each iteration) and enforcing image sparsity (zeroing out small wavelet coefficients). Over iterations, the image converges as missing information is filled in by the constraints. The result is a high-quality image reconstructed from a fraction of the data.</div>
<div style="margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;">If we directly applied an IFFT to undersampled data, we would see strong artifacts due to violation of the Nyquist sampling criterion. With compressed sensing, many of those artifacts are suppressed and the image quality can approach the fully sampled baseline, even when only a fraction of the original k-space samples are acquired. Depending on the sampling pattern, pulse sequence, scanner constraints, and reconstruction setup, this can support meaningful scan-time reductions while helping preserve image quality.</div>
<div style="margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;"><img decoding="async" class="alignnone size-full wp-image-19356" style="vertical-align: baseline; max-width: 100%; height: auto;" src="https://blogs.mathworks.com/deep-learning/files/2026/08/Compressed_sensing_reconstruction.png" alt="Compressed sensing reconstruction of a representative T1-weighted MRI slice" width="850" /></div>
<div style="margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: italic; font-size: 13px; font-weight: 400; text-align: center;">Compressed sensing reconstruction of a representative T1-weighted MRI slice from undersampled, low-SNR input k-space data. The image shows how sparsity-based reconstruction can suppress undersampling artifacts while preserving major anatomical structures.</div>
<div style="margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;">Note: The above code uses functions from Wavelet Toolbox&trade; (wavedec2, waverec2) and can automatically leverage the Parallel Computing Toolbox&trade; to run on a GPU if available (via gpuArray). The iterative CS algorithm is more computationally heavy than IFFT, but GPU acceleration can make it practical for routine use.</div>
<h2 style="margin: 3px 10px 5px 4px; padding: 0px; line-height: 25px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 20px; font-weight: bold; text-align: left;">Deep Learning Reconstruction with U-Net</h2>
<div style="margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;">Our third approach uses deep learning to push MRI reconstruction further. Instead of relying on hand-crafted transforms or optimization, we train a U-Net (a type of convolutional neural network) to learn the transformation from incomplete data to fully reconstructed image. U-Nets are well-suited for image-to-image tasks like segmentation and, here, reconstruction, thanks to their encoder-decoder structure with skip connections that captures both global context and fine details.</div>
<div style="margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;">In our MATLAB example, we feed the network zero-filled IFFT reconstructions of undersampled data as inputs and the corresponding fully sampled images as targets. Using the Deep Learning Toolbox&trade;, we can set up and train the U-Net as follows:</div>
<pre class="codeinput"><span class="comment">% Define a custom U-Net architecture for MRI reconstruction</span>
lgraph = createCustomUNet([256 256 18], 18);

<span class="comment">% Specify training parameters</span>
options = trainingOptions("adam", ...
    InitialLearnRate = 1e-3, ...
    MaxEpochs = 600, ...
    MiniBatchSize = 12);

<span class="comment">% Train the network using undersampled and reference images</span>
net = trainNetwork(inputDataTrain, groundTruthDataTrain, ...
                   lgraph, options);

<span class="comment">% Reconstruct images using the trained network</span>
reconDL = predict(net, inputDataTest);</pre>
<div style="margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;">What&rsquo;s happening? We define a custom U-Net architecture for image-to-image regression and train it on paired data: zero-filled reconstructions from undersampled k-space as inputs and fully sampled reconstructions as targets. The encoder-decoder structure with skip connections helps the network capture both global context and fine image details. Training options such as the optimizer, learning rate, number of epochs, and mini-batch size control the learning process. When a supported GPU is available and the execution environment is set appropriately, MATLAB can use GPU acceleration through Parallel Computing Toolbox&trade;. After training, the predict function generates rapid reconstructions for new undersampled inputs.</div>
<div style="margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;">This deep learning approach learns to map artifact-corrupted, zero-filled reconstructions to reference-quality images. If trained and validated well, the U-Net can reduce residual artifacts compared with conventional undersampled reconstruction and may support higher acceleration factors for a given image-quality target. It also runs very fast at inference because reconstruction is essentially one forward pass through the network. However, deep learning models require representative training data, careful validation, and quality-control checks to ensure that they generalize to new scans and do not introduce unintended artifacts. In practice, combining AI with physics-based methods, such as using a CS reconstruction as an input to the U-Net, can further improve robustness.</div>
<div style="margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;"><img decoding="async" class="alignnone size-full wp-image-19357" style="vertical-align: baseline; max-width: 100%; height: auto;" src="https://blogs.mathworks.com/deep-learning/files/2026/08/Deep_learning_reconstruction.png" alt="Deep learning reconstruction of a representative T1-weighted MRI slice" width="850" /></div>
<div style="margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: italic; font-size: 13px; font-weight: 400; text-align: center;">Deep learning reconstruction of a similar representative T1-weighted MRI slice from the same low-SNR input k-space dataset. The U-Net output is generated from an undersampled input reconstruction and is intended to reduce residual artifacts while preserving fine image detail.</div>
<h2 style="margin: 3px 10px 5px 4px; padding: 0px; line-height: 25px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 20px; font-weight: bold; text-align: left;">Verification, Validation, and Deployment</h2>
<div style="margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;">Developing these algorithms is only part of the story &ndash; practical MRI workflows also require rich visualization and an eye towards deployment:</div>
<ul style="margin: 10px 0px 20px; padding-left: 0px; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-size: 14px;">
  <li style="margin-left: 56px; line-height: 21px; min-height: 0px; text-align: left; white-space: pre-wrap;">Automatic Testing and Verification: Because our three methods are implemented in one environment, we can easily create test scripts to verify that each reconstruction matches expected results (within tolerance) or to measure performance (like PSNR, SSIM) across a dataset. This can be integrated into a CI/CD pipeline (Continuous Integration/Deployment) to ensure code changes don&rsquo;t break the pipeline.</li>
  <li style="margin-left: 56px; line-height: 21px; min-height: 0px; text-align: left; white-space: pre-wrap;">Interactive Visualization and Validation: MATLAB&rsquo;s Medical Imaging Toolbox&trade; provides apps and functions to explore 2D slices and 3D volumes, adjust colormaps (colormap), and even use cinematic volume rendering (volshow). This helps in visually validating results side by side: for example, comparing a CS reconstruction to the IFFT baseline, or overlaying error maps to spot differences.</li>
  <li style="margin-left: 56px; line-height: 21px; min-height: 0px; text-align: left; white-space: pre-wrap;">GPU Code Generation and Deployment: A standout feature is the ability to automatically generate C/C++ and CUDA&reg; code from our MATLAB algorithms for deployment with IEC 62304 certification support. Using MATLAB Coder&trade; and GPU Coder&trade;, we can translate the IFFT, CS, or U-Net reconstruction into highly optimized code for embedded applications or integration into an MRI scanner&rsquo;s software. For instance, we can generate a MEX function or a standalone library from our MATLAB code with just a few commands. The image below shows a snippet of the code generation process in MATLAB:</li>
</ul>
<div style="margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;"><img decoding="async" class="alignnone size-full wp-image-19355" style="vertical-align: baseline; max-width: 100%; height: auto;" src="https://blogs.mathworks.com/deep-learning/files/2026/08/GPU_Code_Gen_600dpi.jpg" alt="GPU code generation in MATLAB for the IFFT reconstruction algorithm" width="850" /></div>
<div style="margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: italic; font-size: 13px; font-weight: 400; text-align: center;">GPU code generation in MATLAB for the IFFT reconstruction algorithm. The code generator converts our MATLAB reconstruction function into a C/CUDA implementation (left: generated code preview and analysis) and reports a successful build (bottom). This enables integrating the proven algorithm into production systems, such as scanner software, with minimal manual coding.</div>
<div style="margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;">Thanks to GPU acceleration and code generation, MRI reconstruction methods developed in MATLAB can scale from desktop prototyping to execution on specialized hardware. For example, once a U-Net is trained and validated in MATLAB, GPU Coder can help deploy inference code that uses optimized NVIDIA&reg; libraries such as cuDNN and TensorRT, reducing the need to hand-code the inference engine.</div>
<h2 style="margin: 3px 10px 5px 4px; padding: 0px; line-height: 25px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 20px; font-weight: bold; text-align: left;">Conclusion and Key Takeaways</h2>
<div style="margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;">By combining classical and AI-based reconstruction techniques in a single MATLAB workflow, we can address the diverse needs of modern MRI systems. A unified environment streamlines the process: raw data import, reconstruction, testing, verification, visualization, validation, and certification can all be done in one place, and when it&rsquo;s time to deploy, the same code is ready for automatic translation to C/CUDA.</div>
<div style="margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;">In summary, this workflow shows how MATLAB can support MRI reconstruction from early experimentation to deployment:</div>
<ul style="margin: 10px 0px 20px; padding-left: 0px; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-size: 14px;">
  <li style="margin-left: 56px; line-height: 21px; min-height: 0px; text-align: left; white-space: pre-wrap;">IFFT reconstruction provides a fast and reliable baseline for fully sampled data.</li>
  <li style="margin-left: 56px; line-height: 21px; min-height: 0px; text-align: left; white-space: pre-wrap;">Compressed sensing enables accelerated acquisitions by combining undersampling, sparsity, and data-consistency constraints.</li>
  <li style="margin-left: 56px; line-height: 21px; min-height: 0px; text-align: left; white-space: pre-wrap;">Deep learning can help reduce artifacts in undersampled reconstructions when trained and validated with representative data.</li>
  <li style="margin-left: 56px; line-height: 21px; min-height: 0px; text-align: left; white-space: pre-wrap;">GPU acceleration and code generation help bridge the gap between research prototypes and deployable reconstruction pipelines.</li>
</ul>
<div style="margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;">We hope this example has shown how classic reconstruction techniques and AI can reinforce each other. By exploring baseline, compressed sensing, and deep learning methods within a unified setting, engineers are empowered to iterate quickly and tailor MRI reconstruction workflows to achieve both faster scans and high image quality, all while maintaining a clear path to real-world deployment.</div>
<h2 style="margin: 3px 10px 5px 4px; padding: 0px; line-height: 25px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 20px; font-weight: bold; text-align: left;">Try the examples yourself: <a href="https://github.com/mathworks/MRI-Reconstruction-in-MATLAB/tree/main" target="_blank" rel="noopener">MRI Reconstruction in MATLAB</a></h2>
</div>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>From PyTorch to Jetson via Simulink: Deploying YOLOv26 Instance Segmentation with Code Generation</title>
		<link>https://blogs.mathworks.com/deep-learning/2026/07/06/from-pytorch-to-jetson-via-simulink-deploying-yolov26-instance-segmentation-with-code-generation/?s_tid=feedtopost</link>
		
		<dc:creator><![CDATA[Johanna Pingel]]></dc:creator>
		<pubDate>Mon, 06 Jul 2026 12:48:00 +0000</pubDate>
				<category><![CDATA[Deep Learning]]></category>
		<guid isPermaLink="false">https://blogs.mathworks.com/deep-learning/?p=19324</guid>

					<description><![CDATA[<div class="overview-image"><img  class="img-responsive" src="https://blogs.mathworks.com/deep-learning/files/2026/07/Bill-Chou.jpg" onError="this.style.display ='none';" /></div><p>








Guest blogger: Bill ChouBill Chou has spent more than 20 years at MathWorks working on code generation technologies. As a Product Manager for MATLAB Coder, GPU Coder, and deep... <a class="read-more" href="https://blogs.mathworks.com/deep-learning/2026/07/06/from-pytorch-to-jetson-via-simulink-deploying-yolov26-instance-segmentation-with-code-generation/">read more >></a></p>]]></description>
										<content:encoded><![CDATA[<div class="rtcContent">
<div>
<div style="margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;"></div>
<div>
<h6></h6>
<table style="background-color: #e2f0ff;">
<tbody>
<tr>
<td style="width: 130px; padding: 10px; vertical-align: top;"><img decoding="async" class="alignnone size-full wp-image-19327" src="https://blogs.mathworks.com/deep-learning/files/2026/07/Bill-Chou.jpg" alt="Bill Chou" width="100" height="100" style="display: block;" /></td>
<td style="vertical-align: middle; padding: 10px;"><strong>Guest blogger: Bill Chou</strong><h6></h6><span style="font-weight: bold;">Bill Chou </span>has spent more than 20 years at MathWorks working on code generation technologies. As a Product Manager for MATLAB Coder, GPU Coder, and deep learning code generation, he helps engineers deploy applications in controls, signal and audio processing, embedded vision, and machine learning across workstations, edge devices, and embedded targets.</td>
</tr>
</tbody>
</table>
<h6></h6>
</div>
<div style="margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;"></div>
</div>
<div></div>
<div style="margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;">A <a href="https://blogs.mathworks.com/deep-learning/2026/05/22/from-pytorch-litert-to-c-c-and-cuda-source-code/" target="_blank" rel="noopener">previous post</a> showed how to generate standalone C/C++ and CUDA source code directly from PyTorch and LiteRT models, with no runtime or inference engine, just portable source code compiled with your existing toolchain. That post started with a simple MLP to illustrate the idea. This one picks up where it left off and asks: what does this look like with a real model processing real video and deployed to real hardware?</div>
<div style="margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;">The answer involves YOLOv26, a driving video, Simulink, and a Jetson AGX Orin. Let&#8217;s walk through it.</div>
<h2 style="margin: 3px 10px 5px 4px; padding: 0px; line-height: 25px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 20px; font-weight: bold; text-align: left;">Why YOLOv26?</h2>
<div style="margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;">If you work in perception, including autonomous driving, robotics, industrial inspection, or video analytics, you&#8217;ve probably encountered YOLO at some point. YOLOv26 has a trick that makes it particularly appealing for code generation: no NMS. The model uses an end-to-end detection architecture with 300 learned object queries. Each query directly produces a unique detection: bounding box, confidence, class, and mask coefficients, without the non-maximum suppression step that traditionally complicates deployment.</div>
<div style="margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;">This matters because NMS involves dynamic-length operations (sorting, filtering with unknown output size) that are less than ideal for static code generation. YOLOv26 sidesteps the problem entirely. You always get exactly 300 detections; just filter by confidence.</div>
<div style="margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;">The updated model does instance segmentation: not just boxes, but pixel-level masks for each detected object.</div>
<div style="margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;"><img decoding="async" class="alignnone size-full wp-image-19339" style="vertical-align: baseline; max-width: 100%; height: auto;" src="https://blogs.mathworks.com/deep-learning/files/2026/07/YOLOv26-side-by-side.jpg" alt="Detected vehicles and traffic lights from input video" width="850" /></div>
<div style="margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: italic; font-size: 13px; font-weight: 400; text-align: center;">Detected vehicles and traffic lights from input video</div>
<div style="margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;">We use the nano variant (~3M parameters, 6.7 MB). Small enough to run on edge hardware, accurate enough to be useful for our purposes.</div>
<h2 style="margin: 3px 10px 5px 4px; padding: 0px; line-height: 25px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 20px; font-weight: bold; text-align: left;">Starting in PyTorch</h2>
<div style="margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;">Many state-of-the-art models are released as PyTorch checkpoints, and YOLOv26 is no exception. We start in Python to grab the pretrained model, wrap it to emit only the two outputs we need, and export to .pt2:</div>
<div style="margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;"><img decoding="async" class="alignnone size-full wp-image-19335" style="vertical-align: baseline; max-width: 100%; height: auto;" src="https://blogs.mathworks.com/deep-learning/files/2026/07/python-yolov26-export.png" alt="Python export wrapper for YOLOv26 nano" width="850" /></div>
<div style="margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: italic; font-size: 13px; font-weight: 400; text-align: center;">Python export wrapper for YOLOv26 nano</div>
<div style="margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;">The .pt2 format (PyTorch ExportedProgram) freezes the computation graph into a static representation. No Python interpreter is needed at inference time and there is no dynamic dispatch, just the math that&#8217;s captured cleanly. This static representation is also what enables execution on edge devices. While the Jetson is a capable platform, every cycle counts when you run on the edge. When running your real-time application, you do not want the hardware to burn resources on a Python runtime and dynamic graph overhead alongside it.</div>
<div style="margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;">We are not just checking that the file loads. We compare the exported model against the original PyTorch model on 128 COCO images, and the outputs match within floating-point tolerance. That gives us confidence that the next stages are validating deployment behavior, not debugging a PyTorch export mismatch.</div>
<h2 style="margin: 3px 10px 5px 4px; padding: 0px; line-height: 25px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 20px; font-weight: bold; text-align: left;">Into MATLAB: Test, Then Generate Code</h2>
<div style="margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;">Loading the model in MATLAB takes one line:</div>
<div style="margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;"><img decoding="async" class="alignnone size-full wp-image-19333" style="vertical-align: baseline; max-width: 100%; height: auto;" src="https://blogs.mathworks.com/deep-learning/files/2026/07/MATLAB-load-pt2-model.png" alt="Load the PyTorch ExportedProgram in MATLAB" width="732" /></div>
<div style="margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: italic; font-size: 13px; font-weight: 400; text-align: center;">Load the PyTorch ExportedProgram in MATLAB</div>
<div style="margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;">That loadPyTorchExportedProgram call from the MATLAB Coder Support Package for PyTorch and LiteRT Models is part of the entry-point function yoloSegmentImagePt2_v26.m, which wraps the full pipeline: resize, normalize, permute to PyTorch&#8217;s NCHW layout, run inference, filter by confidence, generate masks, and annotate. The permutation matches MATLAB image data to PyTorch&#8217;s tensor layout, ensuring YOLOv26 receives the input data in the expected shape and order. The function is designed from the start to be code generation-compatible:</div>
<div style="margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;"><img decoding="async" class="alignnone size-full wp-image-19329" style="vertical-align: baseline; max-width: 100%; height: auto;" src="https://blogs.mathworks.com/deep-learning/files/2026/07/downtown-scene-output.jpg" alt="Run MATLAB inference on a test image" width="800" /></div>
<div style="margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: italic; font-size: 13px; font-weight: 400; text-align: center;">Run MATLAB inference on a test image</div>
<div style="margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;">To verify we&#8217;re still getting the same results, we run the MATLAB interpretation against the full COCO128 dataset, the same 128 images used for Python validation. Detection counts and segmentation outputs match what we saw in Python, confirming that the .pt2 import preserves model behavior end-to-end.</div>
<div style="margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;">But the whole point is to not stop at MATLAB interpretation. We want compiled code.</div>
<div style="margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;"><img decoding="async" class="alignnone size-full wp-image-19331" style="vertical-align: baseline; max-width: 100%; height: auto;" src="https://blogs.mathworks.com/deep-learning/files/2026/07/MATLAB-generate-SIL-code.png" alt="Generate C/C++ code with SIL verification" width="788" /></div>
<div style="margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: italic; font-size: 13px; font-weight: 400; text-align: center;">Generate C/C++ code with SIL verification</div>
<div style="margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;">MATLAB Coder generates C/C++ source code, compiles it, and runs it on the host back-to-back with the MATLAB interpretation using Software-in-the-Loop (SIL) testing. The outputs match, verifying correctness on the x86 architecture before we move to any other target. We reuse the same testing infrastructure here to compare the generated code&#8217;s results against both MATLAB execution and the original Python outputs. Under the hood, the same MLIR-based optimizations from the previous post are at work: operator fusion, vectorization, and hardware-aware code emission.</div>
<h3 style="margin: 3px 10px 5px 4px; padding: 0px; line-height: 23px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 17px; font-weight: bold; text-align: left;">CUDA on the host GPU</h3>
<div style="margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;">Add coder.gpu.kernelfun to your entry-point function and replace coder.config with coder.gpuConfig in the build script to enable CUDA code generation using GPU Coder:</div>
<div style="margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;"><img decoding="async" class="alignnone size-full wp-image-19337" style="vertical-align: baseline; max-width: 100%; height: auto;" src="https://blogs.mathworks.com/deep-learning/files/2026/07/Generate-CUDA-code-with-SIL-verification.png" alt="Generate CUDA code with SIL verification" width="850" /></div>
<div style="margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: italic; font-size: 13px; font-weight: 400; text-align: center;">Generate CUDA code with SIL verification</div>
<div style="margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;">The function and model don&#8217;t change, only the target language does. The generated CUDA kernels are standalone by default with no calls to cuDNN or TensorRT. Just CUDA code that compiles with nvcc (NVIDIA&#8217;s CUDA compiler) and runs on any modern NVIDIA GPU, whether that&#8217;s a desktop workstation, a Jetson, or a cloud instance with an A100.</div>
<div style="margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;">If you do want to leverage TensorRT for optimized layer implementations and FP16 inference, simply replace with these two lines:</div>
<div style="margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;"><img decoding="async" class="alignnone size-full wp-image-19334" style="vertical-align: baseline; max-width: 100%; height: auto;" src="https://blogs.mathworks.com/deep-learning/files/2026/07/matlab-tensorrt-codegen.png" alt="Optionally enable the generated CUDA to call TensorRT with FP16" width="850" /></div>
<div style="margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: italic; font-size: 13px; font-weight: 400; text-align: center;">Optionally enable the generated CUDA to call TensorRT with FP16</div>
<div style="margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;">The standalone path is simpler to deploy as it requires no library dependencies on the target while the TensorRT path trades that simplicity for runtime performance, though with an additional startup cost. Choose based on your constraints.</div>
<div style="margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;">We used the <a href="https://github.com/matlab/matlab-agentic-toolkit" target="_blank" rel="noopener">MATLAB Agentic Toolkit</a> with an AI coding agent throughout the Python and MATLAB sections. The agent acted on our behalf to call MATLAB and import the .pt2 file into the MATLAB code base, set up testing infrastructure, and iterate through the code generation steps for each target. This sped up development considerably, automating many of the steps needed to get our code up and running on the host machine.</div>
<h2 style="margin: 3px 10px 5px 4px; padding: 0px; line-height: 25px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 20px; font-weight: bold; text-align: left;">Deploying to the Jetson AGX Orin</h2>
<div style="margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;">With CUDA code generation working on the host, the next question is: does it run on the actual target hardware? GPU Coder will help us verify this by automating the deployment to the Jetson.</div>
<div style="margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;">You don&#8217;t need to SSH into the Jetson and run commands manually. The entire deployment, including cross-compilation, file transfer, on-target builds, execution, and result retrieval, is orchestrated from MATLAB on your development machine. The jetson() hardware object gives you a programmatic connection to the device, and everything flows through it.</div>
<div style="margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;">The deployment uses a two-phase build to handle a common cross-compilation wrinkle: we need OpenCV for image I/O on the Jetson, but it&#8217;s not installed on the Windows host. Linking at this stage would result in an error.</div>
<div style="margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;">Phase 1 (from MATLAB on host): codegen cross-compiles the entry-point function into ARM64 .o files and transfers them to the Jetson automatically via the hardware object.</div>
<div style="margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;">Phase 2 (triggered from MATLAB, runs on Jetson): MATLAB issues a system(hwobj, ...) call that compiles a custom C++/CUDA main on the Jetson, linking against the device&#8217;s local OpenCV and cuBLAS:</div>
<div style="margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;"><img decoding="async" class="alignnone size-full wp-image-19332" style="vertical-align: baseline; max-width: 100%; height: auto;" src="https://blogs.mathworks.com/deep-learning/files/2026/07/matlab-jetson-deploy.png" alt="Deploy and run inference on Jetson from MATLAB" width="850" /></div>
<div style="margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: italic; font-size: 13px; font-weight: 400; text-align: center;">Deploy and run inference on Jetson from MATLAB</div>
<div style="margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;">The custom main handles the layout conversion that every OpenCV-to-MATLAB bridge needs: BGR row-major (OpenCV) to RGB column-major (MATLAB-generated code) on input, and the reverse on output. It also includes a GPU warm-up step and inference timing.</div>
<div style="margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;"><img decoding="async" class="alignnone size-full wp-image-19329" style="vertical-align: baseline; max-width: 100%; height: auto;" src="https://blogs.mathworks.com/deep-learning/files/2026/07/downtown-scene-output.jpg" alt="Image processed on Jetson matches the results on host machine" width="800" /></div>
<div style="margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: italic; font-size: 13px; font-weight: 400; text-align: center;">Image processed on Jetson matches the results on host machine</div>
<div style="margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;">The whole workflow (connect, cross-compile, transfer, build, run, retrieve) is wrapped in a single script (deployToJetson.m). One command from MATLAB, and you go from source code to running inference on the Jetson and viewing the result on your host.</div>
<h2 style="margin: 3px 10px 5px 4px; padding: 0px; line-height: 25px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 20px; font-weight: bold; text-align: left;">Simulink: From Single Images to Video Streams</h2>
<div style="margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;">With single-image inference validated on both host and Jetson, we move to video. If you&#8217;re building a perception system for a vehicle or a robot, you&#8217;re processing streams, frame after frame, in a pipeline that might include sensor fusion, control logic, and hardware I/O. That&#8217;s Simulink territory.</div>
<div style="margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;">The YOLOv26Pt2VideoSimulink.slx model does exactly what you&#8217;d expect: reads a driving video (winter_driving.mp4), runs YOLOv26 on each frame, and overlays the segmentation results.</div>
<div style="margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;"><img decoding="async" class="alignnone size-full wp-image-19338" style="vertical-align: baseline; max-width: 100%; height: auto;" src="https://blogs.mathworks.com/deep-learning/files/2026/07/YOLOv26-in-Simulink.jpg" alt="YOLOv26 in Simulink model processing input video" width="850" /></div>
<div style="margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: italic; font-size: 13px; font-weight: 400; text-align: center;">YOLOv26 in Simulink model processing input video</div>
<div style="margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;">The interesting part is what&#8217;s inside: a <a href="https://www.mathworks.com/help/coder/ref/pytorchexportedprogramblock.html" target="_blank" rel="noopener">PyTorch ExportedProgram block</a> from the MATLAB Coder Support Package for PyTorch and LiteRT Models. This block loads the .pt2 file directly. You point it at the same yolo26n-seg-2out.pt2 file used previously in the MATLAB stage, configure the input/output dimensions, and it handles inference during simulation and generates C/C++/CUDA code when you build. Two MATLAB Function blocks flank it: one for preprocessing (resize, normalize), one for postprocessing (processMasks.m, createClasses.m). These are largely shared with the standalone MATLAB workflow, so little additional work was needed. The permutation to PyTorch&#8217;s NCHW layout? That&#8217;s handled inside the ExportedProgram block itself, so the flanking blocks stay simpler than in the standalone MATLAB path.</div>
<div style="margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;"><img decoding="async" class="alignnone size-full wp-image-19336" style="vertical-align: baseline; max-width: 100%; height: auto;" src="https://blogs.mathworks.com/deep-learning/files/2026/07/YOLOv26-in-Simulink-with-output-video.jpg" alt="YOLOv26 running in Simulink with the detected objects in the output video stream" width="850" /></div>
<div style="margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: italic; font-size: 13px; font-weight: 400; text-align: center;">YOLOv26 running in Simulink with the detected objects in the output video stream</div>
<div style="margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;">The output is an annotated video with colored segmentation masks, bounding boxes, and class labels for vehicles, pedestrians, and other road objects, all computed frame-by-frame inside Simulink.</div>
<div style="margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;">We could have done all the Simulink work ourselves, but as we did with the MATLAB stage, we opted to use the <a href="https://github.com/matlab/simulink-agentic-toolkit" target="_blank" rel="noopener">Simulink Agentic Toolkit</a> to help inspect block connections, verify signal dimensions, and iterate on the integration of the YOLOv26 network via the PyTorch ExportedProgram block.</div>
<h2 style="margin: 3px 10px 5px 4px; padding: 0px; line-height: 25px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 20px; font-weight: bold; text-align: left;">Generating CUDA from Simulink</h2>
<div style="margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;">Here&#8217;s what we&#8217;ve been building toward. We&#8217;ve validated the model in simulation. Now we generate CUDA code directly from the Simulink model:</div>
<div style="margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;"><img decoding="async" class="alignnone size-full wp-image-19330" style="vertical-align: baseline; max-width: 100%; height: auto;" src="https://blogs.mathworks.com/deep-learning/files/2026/07/Generating-CUDA-code-from-Simulink.jpg" alt="Generating CUDA code from Simulink with GPU Coder" width="850" /></div>
<div style="margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: italic; font-size: 13px; font-weight: 400; text-align: center;">Generating CUDA code from Simulink with GPU Coder</div>
<div style="margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;">The %#codegen pragmas and coder.gpu.kernelfun calls in the helper functions tell GPU Coder to map parallelizable operations to CUDA kernels automatically. Since the pragmas and kernelfun calls were already in place from the MATLAB stage, we&#8217;re not doing anything extra here. We&#8217;re reusing the same code generation-ready functions. The PyTorch ExportedProgram block automatically generates optimized C/C++ or CUDA code to match the code generation settings configured in Simulink, so no additional configuration is needed. The result is standalone CUDA that processes the complete video pipeline: read frame, infer, post-process, annotate, and write frame.</div>
<div style="margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;">Deploying to the Jetson is simpler this time around. We configure the same Jetson settings directly into the Simulink code generation settings, and Simulink + GPU Coder takes care of the rest. The end result is the same: cross-compiling the video pipeline for the Jetson&#8217;s ARM64 + CUDA architecture, managed from Simulink instead of the MATLAB command line.</div>
<h2 style="margin: 3px 10px 5px 4px; padding: 0px; line-height: 25px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 20px; font-weight: bold; text-align: left;">The Agentic AI Angle</h2>
<div style="margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;">A quick sidenote on how this workflow was developed. As briefly mentioned in previous sections, we paired the <a href="https://github.com/matlab/matlab-agentic-toolkit" target="_blank" rel="noopener">MATLAB Agentic Toolkit</a> and <a href="https://github.com/matlab/simulink-agentic-toolkit" target="_blank" rel="noopener">Simulink Agentic Toolkit</a> with an AI coding agent throughout this project. The toolkits give AI agents direct access to MATLAB and Simulink for running code, inspecting models, tweaking code generation settings, and diagnosing build failures.</div>
<div style="margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;">This is especially valuable for the code generation steps, where users will often iterate as they tweak and tune the generated code running on the edge to match their requirements. Having an AI assistant that can run code generation, inspect the results, and retry shortens this loop considerably. And since the AI agents use MATLAB Coder and GPU Coder as trusted tools to generate C/C++ or CUDA code, you still get the same deterministic, reproducible output as if you were using those products directly. Finally, the toolkits are built on an open protocol (MCP) and so this approach extends to any AI assistant that supports it, including Codex, Gemini, or whatever comes next.</div>
<h2 style="margin: 3px 10px 5px 4px; padding: 0px; line-height: 25px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 20px; font-weight: bold; text-align: left;">Wrapping Up</h2>
<div style="margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;">Here&#8217;s the pipeline in full:</div>
<ul style="margin: 10px 0px 20px; padding-left: 0px; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-size: 14px;">
  <li style="margin-left: 56px; line-height: 21px; min-height: 0px; text-align: left; white-space: pre-wrap;">PyTorch: Export YOLOv26 to .pt2, validated with outputs matching within tolerance</li>
  <li style="margin-left: 56px; line-height: 21px; min-height: 0px; text-align: left; white-space: pre-wrap;">MATLAB: Integrate YOLOv26, test against COCO128 images, generate C/C++ and CUDA code with SIL verification</li>
  <li style="margin-left: 56px; line-height: 21px; min-height: 0px; text-align: left; white-space: pre-wrap;">Simulink: Apply YOLOv26 to input video stream and generate CUDA code with minimal changes from MATLAB stage</li>
  <li style="margin-left: 56px; line-height: 21px; min-height: 0px; text-align: left; white-space: pre-wrap;">Jetson: Deploy standalone CUDA on NVIDIA Jetson AGX Orin from both MATLAB and Simulink stages</li>
</ul>
<div style="margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;">The same YOLOv26 model and shared set of MATLAB functions carry you from interpreted prototyping through edge deployment, verified in Python, MATLAB, and Simulink environments along the way. The <a href="https://www.mathworks.com/products/pytorch-litert-onnx-coder.html" target="_blank" rel="noopener">MATLAB Coder Support Package for PyTorch and LiteRT Models</a> is what ties it together, bridging PyTorch&#8217;s research ecosystem with MATLAB and Simulink&#8217;s production deployment infrastructure.</div>
<div style="margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;">If you&#8217;re working on perception for autonomous systems, robotics, or video analytics and want a traceable path from your PyTorch model to embedded hardware without hand-writing CUDA or managing inference runtimes, this is the workflow.</div>
<h2 style="margin: 3px 10px 5px 4px; padding: 0px; line-height: 25px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 20px; font-weight: bold; text-align: left;">Resources</h2>
<ul style="margin: 10px 0px 20px; padding-left: 0px; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-size: 14px;">
  <li style="margin-left: 56px; line-height: 21px; min-height: 0px; text-align: left; white-space: pre-wrap;"><a href="https://www.mathworks.com/matlabcentral/fileexchange/182229-matlab-coder-support-package-for-pytorch-and-litert-models" target="_blank" rel="noopener">MATLAB Coder Support Package for PyTorch and LiteRT Models</a></li>
  <li style="margin-left: 56px; line-height: 21px; min-height: 0px; text-align: left; white-space: pre-wrap;"><a href="https://www.mathworks.com/help/coder/pytorch-litert-codegen.html" target="_blank" rel="noopener">Documentation: Code Generation for PyTorch and LiteRT Models</a></li>
  <li style="margin-left: 56px; line-height: 21px; min-height: 0px; text-align: left; white-space: pre-wrap;"><a href="https://github.com/matlab/matlab-agentic-toolkit" target="_blank" rel="noopener">MATLAB Agentic Toolkit</a></li>
  <li style="margin-left: 56px; line-height: 21px; min-height: 0px; text-align: left; white-space: pre-wrap;"><a href="https://github.com/matlab/simulink-agentic-toolkit" target="_blank" rel="noopener">Simulink Agentic Toolkit</a></li>
</ul>
</div>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>An AI Coding Agent for Embedded AI</title>
		<link>https://blogs.mathworks.com/deep-learning/2026/06/08/an-ai-coding-agent-for-embedded-ai/?s_tid=feedtopost</link>
		
		<dc:creator><![CDATA[Johanna Pingel]]></dc:creator>
		<pubDate>Mon, 08 Jun 2026 13:11:46 +0000</pubDate>
				<category><![CDATA[Deep Learning]]></category>
		<guid isPermaLink="false">https://blogs.mathworks.com/deep-learning/?p=19305</guid>

					<description><![CDATA[<div class="overview-image"><img src="https://blogs.mathworks.com/deep-learning/files/2026/06/embedded-ai-skill-pattern-decision.png" class="img-responsive attachment-post-thumbnail size-post-thumbnail wp-post-image" alt="" decoding="async" loading="lazy" /></div><p>








Guest blogger: Arkadiy Turevskiy

Arkadiy Turevskiy is the Product Manager for AI and Controls products at MathWorks. Arkadiy has been with MathWorks for over 20 years. Before... <a class="read-more" href="https://blogs.mathworks.com/deep-learning/2026/06/08/an-ai-coding-agent-for-embedded-ai/">read more >></a></p>]]></description>
										<content:encoded><![CDATA[<div class="rtcContent">
<div>
<div style="margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;"></div>
<div>
<h6></h6>
<table style="background-color: #e2f0ff;">
<tbody>
<tr>
<td style="width: 130px; padding: 10px; vertical-align: top;"><img loading="lazy" decoding="async" class="alignnone size-full" style="display: block;" src="https://blogs.mathworks.com/deep-learning/files/2026/06/arkadiy_picture.jpg" alt="Arkadiy Turevskiy" width="100" height="100" /></td>
<td style="vertical-align: middle; padding: 10px;"><strong>Guest blogger: <a href="https://www.linkedin.com/in/arkadiy-turevskiy/" target="_blank" rel="noopener">Arkadiy Turevskiy</a></strong>
<h6></h6>
<span style="font-weight: bold;">Arkadiy Turevskiy </span>is the Product Manager for AI and Controls products at MathWorks. Arkadiy has been with MathWorks for over 20 years. Before MathWorks he designed aircraft engine control systems at Pratt &amp; Whitney.</td>
</tr>
</tbody>
</table>
<h6></h6>
</div>
<div style="margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;"></div>
</div>
<div></div>
<div style="margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;">When I deploy a deep learning model from MATLAB to an embedded target, I follow a specific workflow. I know which Deep Learning Toolbox blocks to use in Simulink for simulation speed and code generation. I know when to apply pruning, projection, or quantization to fit a model onto a constrained processor. I've built that expertise over years.</div>
<div style="margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;">The first time I asked Claude Code to help with this workflow, it didn't have any of that context. It burned tokens trying approaches I would have skipped, and missed tools I would have reached for immediately.</div>
<div style="margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;">That was the gap I wanted to close.</div>
<div style="margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;">For the last several weeks my colleague Lucas Garcia and I have been building a skill file for Embedded AI that captures that workflow knowledge and gives it to an agent to avoid the frustrating iterations I experienced. I am excited to share that the improved version of this skill has now been published as part of MATLAB Agentic Toolkit. The skill will trigger when a coding agent detects it is relevant to your project. You can also explicitly tell the agent to invoke this skill.</div>
<h2 style="margin: 3px 10px 5px 4px; padding: 0px; line-height: 25px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 20px; font-weight: bold; text-align: left;">What We Mean by Embedded AI</h2>
<div style="margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;">Embedded AI is AI that runs on resource-constrained hardware, integrated alongside control logic, signal processing, and application code, and validated as part of a larger engineered system. Model accuracy is necessary, but not sufficient: the algorithm must also behave correctly under real-world constraints and remain maintainable.</div>
<div style="margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;">The skill covers two workflow patterns that account for most projects:</div>
<ul style="margin: 10px 0px 20px; padding-left: 0px; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-size: 14px;">
 	<li style="margin-left: 56px; line-height: 21px; min-height: 0px; text-align: left; white-space: pre-wrap;"><strong>Pattern 1</strong> for small models (under 500 KB) on lean hardware such as ARM Cortex-M, Cortex-A/R, and DSPs. Pattern 1 has two pathways. In the first, you train the model directly in MATLAB using Deep Learning Toolbox or Statistics and Machine Learning Toolbox. In the second, you bring in a pre-trained model from a third-party framework such as PyTorch or ONNX, and the agent imports it as a <span style="font-family: Consolas, Monaco, 'Courier New', monospace; background-color: #f0f0f0; padding: 1px 4px;">dlnetwork</span>. From there the path is the same: the agent applies compression - pruning, projection, and/or INT8 quantization - depending on your objectives, integrates the network into Simulink for system-level simulation, and generates C with Embedded Coder.</li>
 	<li style="margin-left: 56px; line-height: 21px; min-height: 0px; text-align: left; white-space: pre-wrap;"><strong>Pattern 2</strong> for larger models (over 1 MB) on high-performance hardware such as x86, GPUs, and Cortex-A. The agent generates C/C++ directly from a PyTorch or LiteRT model using the MATLAB Coder Support Package for PyTorch and LiteRT, with no native rebuild required.</li>
</ul>
<div style="margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;"><img decoding="async" class="imageNode" style="vertical-align: baseline; width: 850px; height: auto; max-width: 100%;" src="https://blogs.mathworks.com/deep-learning/files/2026/06/embedded-ai-skill-pattern-decision.png" alt="Decision tree showing how the skill routes a project to Pattern 1 or Pattern 2 based on model origin, model size, and target hardware" width="850" /></div>
<div style="margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;">The skill picks the pattern automatically after a short conversation about your model, your target, and your constraints.</div>
<h2 style="margin: 3px 10px 5px 4px; padding: 0px; line-height: 25px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 20px; font-weight: bold; text-align: left;">A Short Demo</h2>
<div style="margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;">Here is the agent walking through Pattern 1 - importing a PyTorch LSTM, compressing it for a Cortex-M7, and generating the C code:</div>
<div style="margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;">

<div class="row"><div class="col-xs-12 containing-block"><div class="bc-outer-container add_margin_20"><videoplayer><div class="video-js-container"><video data-video-id="6399678043112" data-video-category="blog" data-autostart="false" data-account="62009828001" data-omniture-account="mathwgbl" data-player="rJ9XCz2Sx" data-embed="default" id="mathworks-brightcove-player" class="video-js" controls></video><script src="//players.brightcove.net/62009828001/rJ9XCz2Sx_default/index.min.js"></script><script>if (typeof(playerLoaded) === 'undefined') {var playerLoaded = false;}(function isVideojsDefined() {if (typeof(videojs) !== 'undefined') {videojs("mathworks-brightcove-player").on('loadedmetadata', function() {playerLoaded = true;});} else {setTimeout(isVideojsDefined, 10);}})();</script></div></videoplayer></div></div></div>

</div>
<div style="margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: italic; font-size: 13px; font-weight: 400; text-align: center;">This demo plays without sound and is shown at accelerated speed. Your experience might be different from what is shown as the skill is frequently updated.</div>
<div style="margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;">A few things worth noticing:</div>
<ul style="margin: 10px 0px 20px; padding-left: 0px; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-size: 14px;">
 	<li style="margin-left: 56px; line-height: 21px; min-height: 0px; text-align: left; white-space: pre-wrap;">The agent <strong>pauses after every workflow step</strong> and asks before moving on. You see each MATLAB script before it runs or after it runs.</li>
 	<li style="margin-left: 56px; line-height: 21px; min-height: 0px; text-align: left; white-space: pre-wrap;">It <strong>detects your installed toolboxes and support packages</strong> silently before the workflow starts, so it never asks you to use something you do not have.</li>
 	<li style="margin-left: 56px; line-height: 21px; min-height: 0px; text-align: left; white-space: pre-wrap;">It opens <strong>Deep Network Designer</strong> so you can inspect the architecture visually, rather than trust a wall of layer-by-layer text output.</li>
 	<li style="margin-left: 56px; line-height: 21px; min-height: 0px; text-align: left; white-space: pre-wrap;">After import, it runs the original model through PyTorch and the rebuilt MATLAB model side by side, then reports mean absolute error and max error explicitly.</li>
</ul>
<div style="margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;">These behaviors are explicitly encoded as rules in the skill file.</div>
<h2 style="margin: 3px 10px 5px 4px; padding: 0px; line-height: 25px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 20px; font-weight: bold; text-align: left;">What Is Inside</h2>
<div style="margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;">The skill is plain markdown - a top-level <span style="font-family: Consolas, Monaco, 'Courier New', monospace; background-color: #f0f0f0; padding: 1px 4px;">SKILL.md</span> plus about a dozen reference files split between <span style="font-family: Consolas, Monaco, 'Courier New', monospace; background-color: #f0f0f0; padding: 1px 4px;">pattern1/</span> and <span style="font-family: Consolas, Monaco, 'Courier New', monospace; background-color: #f0f0f0; padding: 1px 4px;">pattern2/</span>, with shared references for environment discovery, project discovery, and AI verification. <span style="font-family: Consolas, Monaco, 'Courier New', monospace; background-color: #f0f0f0; padding: 1px 4px;">SKILL.md</span> itself is a router with a decision tree, a list of banned legacy functions (<span style="font-family: Consolas, Monaco, 'Courier New', monospace; background-color: #f0f0f0; padding: 1px 4px;">trainNetwork</span>, <span style="font-family: Consolas, Monaco, 'Courier New', monospace; background-color: #f0f0f0; padding: 1px 4px;">DAGNetwork</span>, <span style="font-family: Consolas, Monaco, 'Courier New', monospace; background-color: #f0f0f0; padding: 1px 4px;">importONNXNetwork</span>, etc), and explicit <span style="font-family: Consolas, Monaco, 'Courier New', monospace; background-color: #f0f0f0; padding: 1px 4px;">ALWAYS</span> / <span style="font-family: Consolas, Monaco, 'Courier New', monospace; background-color: #f0f0f0; padding: 1px 4px;">ASK FIRST</span> / <span style="font-family: Consolas, Monaco, 'Courier New', monospace; background-color: #f0f0f0; padding: 1px 4px;">NEVER</span> rules.</div>
<div style="margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;">A few examples:</div>
<ul style="margin: 10px 0px 20px; padding-left: 0px; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-size: 14px;">
 	<li style="margin-left: 56px; line-height: 21px; min-height: 0px; text-align: left; white-space: pre-wrap;"><span style="font-family: Consolas, Monaco, 'Courier New', monospace; background-color: #f0f0f0; padding: 1px 4px;">ALWAYS</span> create a MATLAB script for every workflow step - never run ad-hoc commands - so the engineer can read it, re-run it, and put it under version control.</li>
 	<li style="margin-left: 56px; line-height: 21px; min-height: 0px; text-align: left; white-space: pre-wrap;"><span style="font-family: Consolas, Monaco, 'Courier New', monospace; background-color: #f0f0f0; padding: 1px 4px;">ASK FIRST</span> before code generation: is the target an ARM Cortex-M? If so, enable CMSIS-NN for a significant speedup.</li>
 	<li style="margin-left: 56px; line-height: 21px; min-height: 0px; text-align: left; white-space: pre-wrap;"><span style="font-family: Consolas, Monaco, 'Courier New', monospace; background-color: #f0f0f0; padding: 1px 4px;">NEVER</span> install support packages on the user's behalf.</li>
</ul>
<div style="margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;">The result is an agent that behaves the way an experienced embedded engineer expects a junior teammate to behave: methodical, transparent, and willing to stop and ask.</div>
<h2 style="margin: 3px 10px 5px 4px; padding: 0px; line-height: 25px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 20px; font-weight: bold; text-align: left;">Why This Matters</h2>
<div style="margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;">Agentic coding tools are fast, but the code they produce is non-deterministic and hard to verify. The Embedded AI skill bridges this gap: the agent gives you the speed of natural-language iteration, while MATLAB, Simulink, and Embedded Coder give you deterministic code generation, system-level simulation, and a path to SIL, PIL, and HIL verification. Every step is a MATLAB script and/or Simulink model you can read, re-run, and put under version control.</div>
<div style="margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;">The agent does the typing while you stay in control.</div>
<h2 style="margin: 3px 10px 5px 4px; padding: 0px; line-height: 25px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 20px; font-weight: bold; text-align: left;">Try It Yourself</h2>
<div style="margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;">You will need MATLAB R2026a with Deep Learning Toolbox, MATLAB Coder, Embedded Coder, and the support packages listed in the repo's README. You will also need <a href="https://github.com/matlab/matlab-agentic-toolkit" target="_blank" rel="noopener">MATLAB Agentic Toolkit</a> and <a href="https://github.com/matlab/simulink-agentic-toolkit" target="_blank" rel="noopener">Simulink Agentic Toolkit</a> - both provide the MCP servers the agent uses to talk to MATLAB and Simulink. I tested everything with Claude Code, but the skill format should be straightforward to port to other coding agents.</div>
<div style="margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;">Drop the skill folder into your project's <span style="font-family: Consolas, Monaco, 'Courier New', monospace; background-color: #f0f0f0; padding: 1px 4px;">.claude/skills/</span> directory, start the agent, and describe what you want to deploy. The first thing the agent will do is ask about your model, your target hardware, and your constraints.</div>
<div style="margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;">If you build something with this, I would love to hear about it. Leave a comment below with your thoughts and feedback!</div>
<div style="margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;"></div>
</div>]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>From PyTorch &#038; LiteRT to C, C++, and CUDA source code</title>
		<link>https://blogs.mathworks.com/deep-learning/2026/05/22/from-pytorch-litert-to-c-c-and-cuda-source-code/?s_tid=feedtopost</link>
		
		<dc:creator><![CDATA[Johanna Pingel]]></dc:creator>
		<pubDate>Fri, 22 May 2026 13:19:14 +0000</pubDate>
				<category><![CDATA[Deep Learning]]></category>
		<guid isPermaLink="false">https://blogs.mathworks.com/deep-learning/?p=19285</guid>

					<description><![CDATA[<div class="overview-image"><img  class="img-responsive" src="https://blogs.mathworks.com/deep-learning/files/2026/05/RLU_upload.png" onError="this.style.display ='none';" /></div><p>







Guest writer: Christoph Stockhammer

Christoph Stockhammer is an application engineer at MathWorks, focusing on AI use cases. Christoph holds a Master's in Mathematics from the... <a class="read-more" href="https://blogs.mathworks.com/deep-learning/2026/05/22/from-pytorch-litert-to-c-c-and-cuda-source-code/">read more >></a></p>]]></description>
										<content:encoded><![CDATA[<div class="rtcContent">
<div>
<div style="margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;"></div>
<div>
<h6></h6>
<table style="background-color: #e2f0ff;">
<tbody>
<tr>
<td style="vertical-align: middle; padding: 10px;"><strong>Guest writer: <a href="https://www.linkedin.com/in/christoph-stockhammer/" target="_blank" rel="noopener">Christoph Stockhammer</a></strong>
<h6></h6>
<span style="font-weight: bold;">Christoph Stockhammer </span>is an application engineer at MathWorks, focusing on AI use cases. Christoph holds a Master's in Mathematics from the Technical University of Munich.</td>
</tr>
</tbody>
</table>
<h6></h6>
</div>
<div style="margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;"></div>
</div>
<div></div>
<div>
<div style="margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;">If you have ever tried to deploy a PyTorch model on embedded hardware, you know the story: the model itself is only half the battle. The real challenge starts when you need a runtime, shared libraries, hardware-specific builds, and a toolchain that somehow still fits on your target device.</div>
<div style="margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;">Starting with MATLAB R2026a, there is an alternative route. Instead of shipping a runtime to the device, you can now generate <strong>standalone C/C++ (and CUDA&#174;) source code</strong> directly from <strong>PyTorch ExportedProgram</strong> and <strong>LiteRT</strong> models. No interpreter. No inference engine. No import process into MATLAB. Just readable and portable source code that you compile with your existing toolchain.</div>
<h2 style="margin: 3px 10px 5px 4px; padding: 0px; line-height: 25px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 20px; font-weight: bold; text-align: left;">Why standalone code generation?</h2>
<div style="margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;">Embedded targets--from microcontrollers to devices like Raspberry Pi or NVIDIA&#174; Jetson&#8482;--care deeply about predictability. Memory usage, startup time, and binary size often matter more than flexibility. Runtime-based solutions such as LiteRT (for Microcontrollers) or ONNX Runtime do a great job, but they still bring dependencies and abstraction layers that require more processing power and memory usage above and beyond pure source code.</div>
<div style="margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;">Standalone code generation removes that layer entirely. The generated code contains only what your model needs: loops, math, and data. That makes it easier to analyze, debug, certify, and integrate with existing embedded software.</div>
<h2 style="margin: 3px 10px 5px 4px; padding: 0px; line-height: 25px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 20px; font-weight: bold; text-align: left;">Under the hood: MLIR as the secret sauce</h2>
<div style="margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;">The key technology behind this workflow is <strong>MLIR (Multi-Level Intermediate Representation)</strong>. MATLAB Coder lowers PyTorch ExportedProgram and LiteRT models into <a href="https://mlir.llvm.org/" target="_blank" rel="noopener">MLIR</a>, applies a series of graph- and hardware-aware optimizations, then emits C/C++ or CUDA source code.</div>
<div style="margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;">Because the optimizations happen at the IR level, the generated code can take advantage of:</div>
<ul style="margin: 10px 0px 20px; padding-left: 0px; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-size: 14px;">
 	<li style="margin-left: 56px; line-height: 21px; min-height: 0px; text-align: left; white-space: pre-wrap;">Operator fusion to reduce memory traffic</li>
 	<li style="margin-left: 56px; line-height: 21px; min-height: 0px; text-align: left; white-space: pre-wrap;">Parallel execution using OpenMP on multicore CPUs</li>
 	<li style="margin-left: 56px; line-height: 21px; min-height: 0px; text-align: left; white-space: pre-wrap;">Vectorization (for example, ARM&#174; Neon or Intel&#174; AVX)</li>
 	<li style="margin-left: 56px; line-height: 21px; min-height: 0px; text-align: left; white-space: pre-wrap;">Hardware-specific kernels where available</li>
</ul>
<div style="margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;">The result is code that can be both portable <em>and</em> efficient.</div>
</div>
<div></div>
<div>
<h2 style="margin: 3px 10px 5px 4px; padding: 0px; line-height: 25px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 20px; font-weight: bold; text-align: left;">PyTorch and LiteRT, supported directly</h2>
<div style="margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;">The workflow supports two input formats:</div>
<ul style="margin: 10px 0px 20px; padding-left: 0px; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-size: 14px;">
 	<li style="margin-left: 56px; line-height: 21px; min-height: 0px; text-align: left; white-space: pre-wrap;"><strong>PyTorch ExportedProgram</strong>, for a clean and stable representation of PyTorch models</li>
 	<li style="margin-left: 56px; line-height: 21px; min-height: 0px; text-align: left; white-space: pre-wrap;"><strong>LiteRT</strong>, whether it originates from TensorFlow or is converted from PyTorch models</li>
</ul>
<h2 style="margin: 3px 10px 5px 4px; padding: 0px; line-height: 25px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 20px; font-weight: bold; text-align: left;">A classic example: multi-layer perceptron (MLP)</h2>
<div style="margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;">Feedforward networks based on dense layers are one of the most popular network architectures and they are ideal for introductory examples. So let's look at one:</div>
<div style="margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;">Defining such a network only takes a few lines of code in torch:</div>
<pre style="background-color: #f5f5f5; padding: 10px; border-radius: 4px; font-family: monospace; font-size: 13px; overflow-x: auto;"><code>self.net = nn.Sequential(
    nn.Linear(in_features, hidden1),
    nn.ReLU(),
    nn.Linear(hidden1, hidden2),
    nn.ReLU(),
    nn.Linear(hidden2, out_features)
)</code></pre>
<div style="margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;">Usually, we would train the model with actual data, but for our purposes it suffices to just write the model to disk with the original (randomly initialized) weights and biases:</div>
<pre style="background-color: #f5f5f5; padding: 10px; border-radius: 4px; font-family: monospace; font-size: 13px; overflow-x: auto;"><code>example_inputs = (torch.randn(batch_size, in_features),)
exported_program = torch.export.export(model, example_inputs)
out_file = "three_layer_mlp.pt2"
torch.export.save(exported_program, out_file)</code></pre>
<div style="margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;">This will produce a file "three_layer_mlp.pt2" and we can visualize it in tools such as <a href="https://netron.app/" target="_blank" rel="noopener">Netron</a>. As expected, we see three dense layers (titled "linear") with relu activations in between:</div>
<div style="margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;"><img decoding="async" class="alignnone wp-image-19299" style="vertical-align: baseline; max-width: 200px; height: auto;" src="https://blogs.mathworks.com/deep-learning/files/2026/05/RLU_upload.png" alt="Netron visualization of three-layer MLP showing linear layers with relu activations" width="200" /></div>
</div>
<div></div>
<div>
<div style="margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;">Now, we can go ahead and load this model in MATLAB as well:</div>
<pre style="background-color: #f5f5f5; padding: 10px; border-radius: 4px; font-family: monospace; font-size: 13px; overflow-x: auto; color: #333333;">>> mlp = loadPyTorchExportedProgram('three_layer_mlp.pt2')</pre>
<div style="background-color: #ffffff; padding: 10px; border: none; font-family: monospace; font-size: 13px; overflow-x: auto; color: #555555 !important; white-space: pre;">Loading the model. This may take a few minutes.

mlp =

  PyTorchExportedProgram contained in three_layer_mlp.pt2:

    Input Specifications
    ______________________________________

    Input  Name    Size       Type
    _____  _____   ________   ________

    1      "in1"   "1 x 16"   "single"

    Output Specifications
    _______________________________________

    Output  Name     Size      Type
    ______  ______   _______   ________

    1       "out1"   "1 x 8"   "single"</div>
<div style="margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;">This looks good: We see the correct number of input features (16) and output features (8). It is advisable to also run some inference tests from within MATLAB. For example, I can have the model predict just with some random data:</div>
<pre style="background-color: #f5f5f5; padding: 10px; border-radius: 4px; font-family: monospace; font-size: 13px; overflow-x: auto; color: #333333;">>> invoke(mlp, randn(1,16,'single'))</pre>
<div style="background-color: #ffffff; padding: 10px; border: none; font-family: monospace; font-size: 13px; overflow-x: auto; color: #555555 !important; white-space: pre;">ans =

  1&#215;8 single row vector

   -0.0442   -0.2474    0.3094    0.1759   -0.0768    0.0293    0.1398   -0.0767</div>
<div style="margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;">We now want to move ahead and generate C source code from the model's prediction function. To this end, we just need to put the above commands into a MATLAB function:</div>
<pre style="background-color: #f5f5f5; padding: 10px; border-radius: 4px; font-family: monospace; font-size: 13px; overflow-x: auto;"><code>function predictions = predictModel(inputFeatures)
    mlp = loadPyTorchExportedProgram('three_layer_mlp.pt2');
    predictions = invoke(mlp, inputFeatures);
end</code></pre>
<div style="margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;">As a final step, we generate C source code files with a single MATLAB command:</div>
<pre style="background-color: #f5f5f5; padding: 10px; border-radius: 4px; font-family: monospace; font-size: 13px; overflow-x: auto; color: #333333;">>> codegen -c predictModel.m -args {zeros(1,16,'single')}</pre>
<div style="margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;">My laptop has an Intel i7 processor. In order to improve performance, the code generator recognizes my processor configuration automatically (I could also manually override this with a different configuration if I wanted to). Using this piece of information, the code generator leverages AVX instructions (which my processor supports) for calculating the matrix-vector multiplications which are at the heart of the dense layers. So rather than naive for-loops, I get something like the following in the generated C code:</div>
<pre style="background-color: #f5f5f5; padding: 10px; border-radius: 4px; font-family: monospace; font-size: 13px; overflow-x: auto;"><code>c = _mm256_add_ps(c, _mm256_mul_ps(_mm256_loadu_ps(&amp;A[idxA]), b));</code></pre>
<div style="margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;">Here _mm256_mul_ps is the single precision (FP32) packed multiplication operation using Intel intrinsics, which can lead to much better performance. The above is just one example of how the generated code is optimized to the specific hardware it is intended to be executed on.</div>
</div>
<div></div>
<div>
<h2 style="margin: 3px 10px 5px 4px; padding: 0px; line-height: 25px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 20px; font-weight: bold; text-align: left;">More than just inference</h2>
<div style="margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;">In real applications, neural networks almost never run in isolation. Preprocessing, postprocessing, other control logic and more are almost always part of the story, too. One nice thing about using automated code generation is that you can generate code for the <em>entire application</em>--signal processing, feature extraction, and neural network inference--in one deterministic step.</div>
<div style="margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;">Example applications, including the MATLAB code and Simulink models, ship with this capability. For example, running <a href="https://www.mathworks.com/help/coder/ug/integrate-and-generate-code-for-depth-anything-v2-in-simulink.html" target="_blank" rel="noopener">monocular depth estimation using Depth Anything V2 PyTorch Model</a> can be used for applications such as autonomous driving and navigation.</div>
<div style="margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;"><img decoding="async" class="alignnone wp-image-19295" style="vertical-align: baseline; max-width: 800px; height: auto;" src="https://blogs.mathworks.com/deep-learning/files/2026/05/Depth-Anything-V2-output.png" alt="Monocular depth estimation example showing original image and depth map side by side" width="800" /></div>
<div style="margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;">The <a href="https://www.mathworks.com/help/coder/ug/generate-CUDA-code-for-YOLO-v11-segmentation-and-object-detection-LiteRT-model.html" target="_blank" rel="noopener">segmentation and object detection using YOLO v11 LiteRT model</a> example shows how to identify and outline objects to enable image segmentation and detection, all without relying on NVIDIA cuDNN or TensorRT&#8482; libraries.</div>
<div style="margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;"><img loading="lazy" decoding="async" width="560" height="337" class="alignnone size-full wp-image-19297" style="vertical-align: baseline;" src="https://blogs.mathworks.com/deep-learning/files/2026/05/YOLOv11-output.png" alt="YOLO v11 segmentation and object detection example" /></div>
<div style="margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;">Finally, the <a href="https://www.mathworks.com/help/coder/ug/integrate-and-generate-code-for-battery-state-of-charge-in-simulink-using-liteRT-block.html" target="_blank" rel="noopener">predict battery state of charge using LiteRT model</a> example shows the workflow to deploy an AI model that predicts the battery state of charge (SOC), a key metric for energy management systems in electric vehicles and other battery-powered devices.</div>
<div style="margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;"><img loading="lazy" decoding="async" width="616" height="371" class="alignnone size-full wp-image-19294" style="vertical-align: baseline;" src="https://blogs.mathworks.com/deep-learning/files/2026/05/BSoC-output.png" alt="Predicted BSOC vs Ground truth chart" /></div>
<div style="margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;">In this day and age, one could also consider Generative AI tools when looking for C or C++ source. One major distinction of the workflow we described above is that it is <em>deterministic</em> and <em>traceable</em>. If you generate the C sources ten times (using the same configuration) it will produce the exact same C sources ten times. No dependency on backend large language models, context or prompts.</div>
</div>
<div></div>
<div>
<h2 style="margin: 3px 10px 5px 4px; padding: 0px; line-height: 25px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 20px; font-weight: bold; text-align: left;">A practical alternative to runtimes</h2>
<div style="margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;">Our benchmarks show that the generated code delivers performance quite comparable to runtime-based approaches. Just as importantly, the code is human-readable, configurable, and re-entrant as needed.</div>
<div style="margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;">Here is a chart showing the performance of the automatically generated code vs LiteRT for several popular network architectures on Raspberry Pi 4. In the initial release, our focus is on supporting as many networks and layers as possible given our users' propensity to use many different types of networks. Many optimizations are planned and we anticipate matching and exceeding the performance of the interpreter in subsequent releases:</div>
<div style="margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;"><img decoding="async" class="alignnone wp-image-19296" style="vertical-align: baseline; max-width: 800px; height: auto;" src="https://blogs.mathworks.com/deep-learning/files/2026/05/Raspberry-Pi-4-benchmark-R2026a.png" alt="Performance comparison chart: Generated Code vs LiteRT C++ interpreter on Raspberry Pi 4 ARM Cortex-A for various network architectures" width="800" /></div>
<div style="margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;">In summary: If you are looking for an AI deployment workflow that prioritizes transparency, portability, and tight integration with embedded systems, standalone code generation from PyTorch and LiteRT using MATLAB Coder is well worth a look.</div>
</div>
</div>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Less Typing, More Creating: MATLAB Copilot Comes to Your Android Phone</title>
		<link>https://blogs.mathworks.com/deep-learning/2026/04/07/less-typing-more-creating-matlab-copilot-comes-to-your-phone/?s_tid=feedtopost</link>
		
		<dc:creator><![CDATA[Yann Debray]]></dc:creator>
		<pubDate>Tue, 07 Apr 2026 14:07:52 +0000</pubDate>
				<category><![CDATA[Agentic AI]]></category>
		<category><![CDATA[Generative AI]]></category>
		<category><![CDATA[MATLAB Online]]></category>
		<guid isPermaLink="false">https://blogs.mathworks.com/deep-learning/?p=19242</guid>

					<description><![CDATA[<div class="overview-image"><img src="https://blogs.mathworks.com/deep-learning/files/2026/04/MATLABCopilotOnMobileBlogPost_1.png" class="img-responsive attachment-post-thumbnail size-post-thumbnail wp-post-image" alt="" decoding="async" loading="lazy" /></div><p>






Guest Co-author: Tharikaa Ramesh Kumar, PhD

Tharikaa is the Product Manager for MATLAB Mobile. She holds a PhD in Aerospace Engineering from Auburn University, where she taught... <a class="read-more" href="https://blogs.mathworks.com/deep-learning/2026/04/07/less-typing-more-creating-matlab-copilot-comes-to-your-phone/">read more >></a></p>]]></description>
										<content:encoded><![CDATA[<div class="rtcContent">
<div style="margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;">
<div>
<table style="background-color: #e2f0ff;">
<tbody>
<tr>
<td style="width: 120px; padding: 3px; vertical-align: middle;"><img loading="lazy" decoding="async" class="aligncenter wp-image-19243" src="https://blogs.mathworks.com/deep-learning/files/2026/04/tharikaa.png" alt="" width="100" height="100" /></td>
<td style="vertical-align: middle; padding: 3px;"><strong>Guest Co-author: <a href="https://www.linkedin.com/in/tharikaa-ramesh-kumar/" target="_blank" rel="noopener">Tharikaa Ramesh Kumar, PhD</a></strong>
<h6></h6>
<strong>Tharikaa</strong> is the Product Manager for MATLAB Mobile. She holds a PhD in Aerospace Engineering from Auburn University, where she taught dynamics and systems courses using MATLAB as a graduate instructor.</td>
</tr>
</tbody>
</table>
<br>

<span style="font-size: 14px; font-weight: 400;">I'm excited to share some news that I think will change the way many of you use MATLAB on the go. We've brought </span><a style="font-size: 14px; font-weight: 400;" href="https://www.mathworks.com/products/matlab-copilot.html">MATLAB Copilot</a><span style="font-size: 14px; font-weight: 400;"> to </span><a style="font-size: 14px; font-weight: 400;" href="https://www.mathworks.com/products/matlab-mobile.html">MATLAB Mobile</a><span style="font-size: 14px; font-weight: 400;">, and it's available for now on Android with two features: </span><span style="font-weight: bold;">Copilot Chat</span><span style="font-size: 14px; font-weight: 400;"> and </span><span style="font-weight: bold;">Explain Code</span><span style="font-size: 14px; font-weight: 400;">. </span>

If you've ever been on a commute, in a lecture hall, or out in the field and wished you could quickly prototype an idea in MATLAB, you know the challenge. You pull out your phone, open MATLAB Mobile, and start typing on a small touch keyboard. It works, but it's not exactly the same as sitting at your desk. That's where Copilot comes in.

</div>
<h2></h2>
<h2 style="margin: 3px 10px 5px 4px; padding: 0px; line-height: 25px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 20px; font-weight: bold; text-align: left;">Why an AI Assistant on Your Phone Changes Things</h2>
<div style="margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;">Let's be honest: coding on a phone has its limitations. The screen is smaller, the keyboard is touch-based, and switching between your code and documentation is a juggling act. MATLAB Copilot reduces that friction significantly.</div>
<div style="margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;">With Copilot Chat, you describe what you want in natural language and get MATLAB code you can run right away. Instead of typing out every function call and argument, you tell Copilot what you need and it writes the code for you. Less typing, more creating!</div>
<div style="margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;">Here is a bonus: your phone keyboard already has a microphone button for speech-to-text. Tap it, speak your Copilot prompt, and the code appears. You do not even need to type your request. Between voice input and AI-generated code, this is as close to a low-code experience as it gets on a phone. And when you do type, your phone keyboard's predictive text and autocomplete suggestions help you write prompts faster than you would on a desktop keyboard.</div>
<div style="margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;">For the many students and educators who use MATLAB Mobile every day, this is especially valuable. Your phone is the one device that's always with you and always charged. It's more personal and more accessible than a laptop. With Copilot on that same device, you get answers and explanations on the spot, right where you are, instead of waiting to get back to a computer.</div>
<div style="margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: center;"><img loading="lazy" decoding="async" class="imageNode" style="vertical-align: baseline; width: 382px; height: 802px;" src="https://blogs.mathworks.com/deep-learning/files/2026/04/MATLABCopilotOnMobileBlogPost_1.png" alt="" width="382" height="802" /></div>
<h2></h2>
<h2 style="margin: 3px 10px 5px 4px; padding: 0px; line-height: 25px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 20px; font-weight: bold; text-align: left;">Copilot Chat</h2>
<div style="margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;">Copilot Chat is a conversational AI assistant built right into MATLAB Mobile. You can access it from the Command Window, the Editor, or the app menu. Ask a question, describe the code you need, or request an explanation. Copilot responds with answers grounded in MathWorks documentation.</div>
<div style="margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;">Here is where it really shines on mobile. Say you've just collected accelerometer data from your phone's sensors using MATLAB Mobile's built-in sensor support. You want to plot the x, y, and z axes on a single figure, but you can't remember the exact syntax. Open Copilot Chat and describe what you're looking for. Copilot generates a ready-to-run snippet that handles the <span style="font-family: monospace;">plot</span> calls, axis labels, and legend for you. Tap to insert the code, hit Run, and you're looking at your data.</div>
<div style="margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;">It works just as well for broader questions. If you're wondering how to apply a low-pass filter to audio you recorded on your phone, ask Copilot. Need a quick refresher on how <span style="font-family: monospace;">fft</span> works? Ask Copilot. It handles everything from basic syntax help to signal processing workflows, and every response draws from official MathWorks documentation so the code follows best practices.</div>
<div style="margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;">As with all things GenAI, your results will depend on your specific question and context.</div>
<div style="margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: center;"><div class="row"><div class="col-xs-12 containing-block"><div class="bc-outer-container add_margin_20"><videoplayer><div class="video-js-container"><video data-video-id="6392647109112" data-video-category="blog" data-autostart="false" data-account="62009828001" data-omniture-account="mathwgbl" data-player="rJ9XCz2Sx" data-embed="default" id="mathworks-brightcove-player" class="video-js" controls></video><script src="//players.brightcove.net/62009828001/rJ9XCz2Sx_default/index.min.js"></script><script>if (typeof(playerLoaded) === 'undefined') {var playerLoaded = false;}(function isVideojsDefined() {if (typeof(videojs) !== 'undefined') {videojs("mathworks-brightcove-player").on('loadedmetadata', function() {playerLoaded = true;});} else {setTimeout(isVideojsDefined, 10);}})();</script></div></videoplayer></div></div></div></div>
<h2></h2>
<h2 style="margin: 3px 10px 5px 4px; padding: 0px; line-height: 25px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 20px; font-weight: bold; text-align: left;">Explain Code</h2>
<div style="margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;">The second feature we're bringing to MATLAB Mobile is Explain Code. Select any block of code in the Editor, tap Explain Code, and get a plain-language overview of what the code does along with a line-by-line walkthrough in the Chat panel.</div>
<div style="margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;">On a small screen, dense code can be tough to read. Explain Code helps you make sense of it quickly. Say you open a shared script from MATLAB Drive, maybe a classmate's assignment or an instructor's demo file, and encounter a block of code using <span style="font-family: monospace;">fft</span>, windowing functions, and inverse transforms. Instead of switching apps to search the documentation, select the code and tap Explain Code. Copilot gives you an overview of the block's purpose and annotates each line so you understand not just <span style="font-style: italic;">what</span> the code does, but <span style="font-style: italic;">how</span>.</div>
<div style="margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;">This is incredibly useful for learning. Students can review code before an exam and actually understand each line. TAs can quickly parse student submissions between classes. Professors can pull up a demo script and get a refresher before a lecture. All from their phone.</div>
<div style="margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: center;"><div class="row"><div class="col-xs-12 containing-block"><div class="bc-outer-container add_margin_20"><videoplayer><div class="video-js-container"><video data-video-id="6392647020112" data-video-category="blog" data-autostart="false" data-account="62009828001" data-omniture-account="mathwgbl" data-player="rJ9XCz2Sx" data-embed="default" id="mathworks-brightcove-player" class="video-js" controls></video><script src="//players.brightcove.net/62009828001/rJ9XCz2Sx_default/index.min.js"></script><script>if (typeof(playerLoaded) === 'undefined') {var playerLoaded = false;}(function isVideojsDefined() {if (typeof(videojs) !== 'undefined') {videojs("mathworks-brightcove-player").on('loadedmetadata', function() {playerLoaded = true;});} else {setTimeout(isVideojsDefined, 10);}})();</script></div></videoplayer></div></div></div></div>
<h2></h2>
<h2 style="margin: 3px 10px 5px 4px; padding: 0px; line-height: 25px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 20px; font-weight: bold; text-align: left;">When Will You Use This?</h2>
<div style="margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;"><span style="font-weight: bold;">The student on the bus.</span> You're reviewing the signal processing examples your professor shared on MATLAB Drive. You select the Fourier transform code block, tap Explain Code, and get a line-by-line breakdown. By the time you arrive, you understand exactly how the frequency domain conversion works.</div>
<div style="margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;"><span style="font-weight: bold;">The professor between classes.</span> A student messages you about an error in their script. You open MATLAB Mobile, describe the issue to Copilot Chat, and get a suggested fix. Share the chat history directly through your phone's messaging apps, or save it as a .txt file to MATLAB Drive for later reference. No laptop needed.</div>
<div style="margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: center;"><img loading="lazy" decoding="async" class="imageNode" style="vertical-align: baseline; width: 355px; height: 743px;" src="https://blogs.mathworks.com/deep-learning/files/2026/04/MATLABCopilotOnMobileBlogPost_5.png" alt="" width="355" height="743" /></div>
<div style="margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;"><span style="font-weight: bold;">The engineer in the field.</span> You're collecting magnetometer data with MATLAB Mobile's sensor support and want to visualize the magnetic field direction. You ask Copilot Chat how to create the visualization. It generates the code, you run it on the spot, and you see results immediately.</div>
<div style="margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;">And here is the thing: none of this work is stuck on your phone. Every script you create with Copilot syncs to MATLAB Drive, so you can start prototyping on the bus and pick up right where you left off on your desktop. Copilot on your phone is not a separate experience. It is part of the same workflow.</div>
<div style="margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;">We hear from students and researchers all the time that their phone is always with them, even when their laptop isn't. Now, MATLAB Copilot is right there too.</div>
<h2></h2>
<h2 style="margin: 3px 10px 5px 4px; padding: 0px; line-height: 25px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 20px; font-weight: bold; text-align: left;">How to Get Started</h2>
<div style="margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;">Getting started takes just a few steps:</div>
<ol>
 	<li><span style="font-weight: bold;">Install or update MATLAB Mobile</span> from the <a href="https://play.google.com/store/apps/details?id=com.mathworks.matlabmobile">Google Play</a> (Android). The app is free to download.</li>
 	<li><span style="font-weight: bold;">Check your MATLAB Copilot license.</span> You'll need a MATLAB Copilot license to use Copilot Chat and Explain Code. Many university campus-wide licenses already include MATLAB Copilot. Check with your institution's MATLAB administrator. Individual and team licenses that include Copilot work as well.</li>
 	<li><span style="font-weight: bold;">Start using it.</span> Open MATLAB Mobile and access Copilot Chat from the Command Window, the Editor, or the app menu. To try Explain Code, select code in the Editor and choose "Explain Code." That's it.</li>
</ol>
<div style="margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;">For more details, visit the <a href="https://www.mathworks.com/help/matlab-copilot/">MATLAB Copilot documentation</a> and the <a href="https://www.mathworks.com/products/matlab-mobile.html">MATLAB Mobile product page</a>.</div>
<h2></h2>
<h2 style="margin: 3px 10px 5px 4px; padding: 0px; line-height: 25px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 20px; font-weight: bold; text-align: left;">Try It Out</h2>
<div style="margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;">We've been looking forward to getting this into your hands. Update MATLAB Mobile, open Copilot Chat, and ask your first question. I think you'll be surprised how quickly it becomes part of your workflow.</div>
<div style="margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #212121; font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;">We'd love to hear how you're using MATLAB Copilot on Mobile. Drop a comment below or share your experience with <span style="font-weight: bold;">#MATLABMobile</span>.</div>
<div></div>
</div>
<script type="text/javascript">var css = ''; var head = document.head || document.getElementsByTagName('head')[0], style = document.createElement('style'); head.appendChild(style); style.type = 'text/css'; if (style.styleSheet){ style.styleSheet.cssText = css; } else { style.appendChild(document.createTextNode(css)); }</script>

</div><br>]]></content:encoded>
					
		
		
			</item>
	</channel>
</rss>
