メインコンテンツ

結果:

Walter Roberson
Walter Roberson
最後のアクティビティ: 2025 年 9 月 18 日 16:18

I just noticed that MATLAB R2025b is available. I am a bit surprised, as I never got notification of the beta test for it.
This topic is for highlights and experiences with R2025b.
Dyuman Joshi
Dyuman Joshi
最後のアクティビティ: 2025 年 9 月 19 日 7:24

For some time now, this has been bugging me - so I thought to gather some more feedback/information/opinions on this.
What would you classify Recursion? As a loop or as a vectorized section of code?
For context, this query occured to me while creating Cody problems involving strict (so to speak) vectorization - (Everyone is more than welcome to check my recent Cody questions).
To make problems interesting and/or difficult, I (and other posters) ban functions and functionalities - such as for loops, while loops, if-else statements, arrayfun() and the rest of the fun() family functions. However, some of the solutions including the reference solution I came up with for my latest problem, contained recursion.
I am rather divided on how to categorize it. What do you think?
Author: Nguyễn Khánh Tùng
ORCID: 0009-0002-9877-4137
Abstract
Every fundamental law of physics has a characteristic quantity and a unit of measurement (e.g., Newton for force, Joule for energy). The NKTg Law (Law of Varying Inertia) introduces a new physical quantity — varying inertia — defined by the interaction between position, velocity, and mass.
To measure this new quantity, I propose the NKTm unit, verified with NASA JPL Horizons data (Neptune, 2023–2024). Results indicate that NKTm is an independent fundamental unit, comparable in significance to Newton, Pascal, Joule, and Watt, with applications in astronomy, aerospace, and engineering.
This article clarifies the measurement unit of the NKTg Law (NKTm) and highlights its applications, many of which I have already implemented and shared as code examples on MATLAB Central.
1. Theoretical Basis
The NKTg Law describes motion under the combined effect of position (x), velocity (v), and mass (m):
NKTg=f(x,v,m)NKTg = f(x, v, m)NKTg=f(x,v,m)
Two expressions define varying inertia:
  • NKTg₁ = x·p (Position–Momentum interaction)
  • NKTg₂ = (dm/dt)·p (Mass-variation–Momentum interaction)
Both are measured by the same unit: NKTm.2. Dimensional Analysis
  • From NKTg₁: [ML2/T][M·L²/T][ML2/T]
  • From NKTg₂: [M2L/T2][M²·L/T²][M2L/T2]
Thus, NKTm is a unique unit that can take different dimensional forms depending on which component dominates.
For comparison:
QuantityUnitDimensionForceNewton (N)[M·L/T²]EnergyJoule (J)[M·L²/T²]PowerWatt (W)[M·L²/T³]Varying inertia (NKTg₁)NKTm[M·L²/T]Varying inertia (NKTg₂)NKTm[M²·L/T²]
3. Verification with NASA Data (Neptune, 2023–2024)
  • Position (x): 4.498×1094.498 \times 10^94.498×109 km
  • Velocity (v): 5.43 km/s
  • Mass (m): 1.0243×10261.0243 \times 10^{26}1.0243×1026 kg
  • Momentum (p = m·v): 5.564×10265.564 \times 10^{26}5.564×1026 kg·m/s
Results:
  • NKTg₁ = x·p ≈ 2.503 × 10³⁶ NKTm
  • NKTg₂ ≈ -1.113 × 10²² NKTm (assumed micro gas escape)
  • Total NKTg ≈ 2.501 × 10³⁶ NKTm
4. Applications
  • Astronomy: describe planetary mass variation, star/galaxy formation, and long-term orbital stability.
  • Aerospace: optimize rocket fuel usage, account for mass leakage, design ion/plasma engines.
  • Earth sciences: analyze GRACE-FO data, model ice melting, sea-level rise, and mass redistribution.
  • Engineering: variable-mass robotics, cargo systems, vibration analysis, fluid/particle simulations.
👉 Many of these applications are already available as MATLAB code examples that I have uploaded to MATLAB Central, showing how NKTm can be computed and applied in practice.5. Scientific Significance
  • Establishes a new fundamental unit (NKTm), independent of Newton and Joule.
  • Provides a theoretical framework for variable-mass dynamics, beyond Newton and Einstein.
  • Supports accurate computation and simulation of real-world systems with mass variation.
Conclusion
The introduction of the NKTm unit demonstrates that varying inertia is a measurable, independent physical quantity. Like Newton or Joule, NKTm lays the foundation for a new reference system in physics, with applications ranging from planetary mechanics to modern space technology.
This article not only clarifies the measurement standard of the NKTg Law, but also connects directly with practical MATLAB implementations for simulation and verification.
Discussion prompt:
What do you think about introducing a new physical unit like NKTm? Could it be integrated into MATLAB-based simulation frameworks for variable-mass systems?
Have you ever been enrolled in a course that uses an LMS and there is an assignment that invovles posting a question to, or answering a question in, a discussion group? This discussion group is meant to simulate that experience.
Chen Lin
Chen Lin
最後のアクティビティ: 2025 年 9 月 16 日 20:50

I came across this fun video from @Christoper Lum, and I have to admit—his MathWorks swag collection is pretty impressive! He’s got pieces I even don’t have.
So now I’m curious… what MathWorks swag do you have hiding in your office or closet?
  • Which one is your favorite?
  • Which ones do you want to add to your collection?
Show off your swag and share it with the community! 🚀
Nguyễn Khánh Tùng
ORCID iD: 0009-0002-9877-4137
Theoretical Basis
The NKTg Law of Variable Inertia:
An object's tendency of motion in space depends on its position (x), velocity (v), and mass (m).
NKTg = f(x, v, m)
Fundamental interaction quantities:
NKTg1 = x * p
NKTg2 = (dm/dt) * p
where
p = m * v
For interpolation, we use:
m = NKTg1 / (x * v)
Research Objectives
  1. Verify interpolation of planetary masses using NKTg law.
  2. Compare with NASA real-time data (31/12/2024).
  3. Test sensitivity with Earth’s mass loss (NASA GRACE).
MATLAB Implementation
% NKTg Law Verification in MATLAB
% Author: Nguyen Khanh Tung
% Date: 31-12-2024
% Planetary data from NASA (30/12/2024)
planets = {
'Mercury','Venus','Earth','Mars','Jupiter','Saturn','Uranus','Neptune'};
x = [6.9817930e7, 1.08939e8, 1.471e8, 2.4923e8, ...
8.1662e8, 1.50653e9, 3.00139e9, 4.5589e9]; % km
v = [38.86, 35.02, 29.29, 24.07, 13.06, 9.69, 6.8, 5.43]; % km/s
m_nasa = [3.301e23, 4.867e24, 5.972e24, 6.417e23, ...
1.898e27, 5.683e26, 8.681e25, 1.024e26]; % kg
% Compute momentum
p = m_nasa .* v;
% Compute NKTg1
NKTg1 = x .* p;
% Interpolated masses using m = NKTg1 / (x*v)
m_interp = NKTg1 ./ (x .* v);
% Compare results in a table
T = table(planets', m_nasa', m_interp', (m_nasa - m_interp)', ...
'VariableNames', {'Planet','NASA_mass','Interpolated_mass','Delta_m'})
disp(T)
Results
  • All 8 planets’ interpolated masses match NASA values almost perfectly.
  • Deviation (Delta_m) ≈ 0 → error < 0.0001%.
  • Confirms that NKTg1 is conserved across planetary orbits.
Earth’s Mass Loss (GRACE/GRACE-FO)
  • GRACE missions show Earth loses mass annually (10^20 – 10^21 kg/year).
  • NKTg interpolation detects Δm ≈ 3 × 10^19 kg.
  • This matches the lower bound of NASA’s measured range.
Conclusion
  • NKTg₁ interpolation is extremely accurate for planetary masses.
  • Planetary data can be reconstructed with negligible error.
  • NKTg model is sensitive enough to capture Earth’s small annual mass loss.
Javier Maruenda
Javier Maruenda
最後のアクティビティ: 2025 年 9 月 12 日 12:48

The functionality would allow report generation straight from live scripts that could be shared without exposing the code. This could be useful for cases where the recipient of the report only cares about the results and not the code details, or when the methodology is part of a company know how, e.g. Engineering services companies.

In order for it to be practical for use it would also require that variable values could be inserted into the text blocks, e.g. #var_name# would insert the value of the variable "var_name" and possibly selecting which code blocks to be hidden.

Subha
Subha
最後のアクティビティ: 2025 年 9 月 14 日 7:41

“Hello, I am Subha & I’m part of the organizing/mentoring team for NASA Space Apps Challenge Virudhunagar 2025 🚀. We’re looking for collaborators/mentors with ML and MATLAB expertise to help our student teams bring their space solutions to life. Would you be open to guiding us, even briefly? Your support could impact students tackling real NASA challenges. 🌍✨”
cui,xingxing
cui,xingxing
最後のアクティビティ: 2025 年 9 月 5 日 10:59

Since R2024b, a Levenberg–Marquardt solver (TrainingOptionsLM) was introduced. The built‑in function trainnet now accepts training options via the trainingOptions function (https://www.mathworks.com/help/deeplearning/ref/trainingoptions.html#bu59f0q-2) and supports the LM algorithm. I have been curious how to use it in deep learning, and the official documentation has not provided a concrete usage example so far. Below I give a simple example to illustrate how to use this LM algorithm to optimize a small number of learnable parameters.
For example, consider the nonlinear function:
y_hat = @(a,t) a(1)*(t/100) + a(2)*(t/100).^2 + a(3)*(t/100).^3 + a(4)*(t/100).^4;
It represents a curve. Given 100 matching points (t → y_hat), we want to use least squares to estimate the four parameters a1​–a4​.
t = (1:100)';
y_hat = @(a,t)a(1)*(t/100) + a(2)*(t/100).^2 + a(3)*(t/100).^3 + a(4)*(t/100).^4;
x_true = [ 20 ; 10 ; 1 ; 50 ];
y_true = y_hat(x_true,t);
plot(t,y_true,'o-')
  • Using the traditional lsqcurvefit-wrapped "Levenberg–Marquardt" algorithm:
x_guess = [ 5 ; 2 ; 0.2 ; -10 ];
options = optimoptions("lsqcurvefit",Algorithm="levenberg-marquardt",MaxFunctionEvaluations=800);
[x,resnorm,residual,exitflag] = lsqcurvefit(y_hat,x_guess,t,y_true,-50*ones(4,1),60*ones(4,1),options);
Local minimum found. Optimization completed because the size of the gradient is less than 1e-4 times the value of the function tolerance.
x,resnorm,exitflag
x = 4×1
20.0000 10.0000 1.0000 50.0000
<mw-icon class=""></mw-icon>
<mw-icon class=""></mw-icon>
resnorm = 9.7325e-20
exitflag = 1
  • Using the deep-learning-wrapped "Levenberg–Marquardt" algorithm:
options = trainingOptions("lm", ...
InitialDampingFactor=0.002, ...
MaxDampingFactor=1e9, ...
DampingIncreaseFactor=12, ...
DampingDecreaseFactor=0.2,...
GradientTolerance=1e-6, ...
StepTolerance=1e-6,...
Plots="training-progress");
numFeatures = 1;
layers = [featureInputLayer(numFeatures,'Name','input')
fitCurveLayer(Name='fitCurve')];
net = dlnetwork(layers);
XData = dlarray(t);
YData = dlarray(y_true);
netTrained = trainnet(XData,YData,net,"mse",options);
Iteration TimeElapsed TrainingLoss GradientNorm StepNorm _________ ___________ ____________ ____________ ________ 1 00:00:03 0.35754 0.053592 39.649
Warning: Error occurred while executing the listener callback for event LogUpdate defined for class deep.internal.train.SerialMetricManager:
Error using matlab.internal.capability.Capability.require (line 94)
This functionality is not available on remote platforms.

Error in matlab.ui.internal.uifigureImpl (line 33)
Capability.require(Capability.WebWindow);
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Error in uifigure (line 34)
window = matlab.ui.internal.uifigureImpl(false, varargin{:});
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Error in deepmonitor.internal.DLTMonitorView/createGUIComponents (line 167)
this.Figure = uifigure("Tag", "DEEPMONITOR_UIFIGURE");
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Error in deepmonitor.internal.DLTMonitorView (line 123)
this.createGUIComponents();
^^^^^^^^^^^^^^^^^^^^^^^^^^
Error in deepmonitor.internal.DLTMonitorFactory/createStandaloneView (line 8)
view = deepmonitor.internal.DLTMonitorView(model, this);
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Error in deep.TrainingProgressMonitor/set.Visible (line 224)
this.View = this.Factory.createStandaloneView(this.Model);
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Error in deep.internal.train.MonitorConfiguration/updateMonitor (line 173)
monitor.Visible = true;
^^^^^^^^^^^^^^^
Error in deep.internal.train.MonitorConfiguration>@(logger,evtData)weakThis.Handle.updateMonitor(evtData,visible) (line 154)
this.Listeners{end+1} = listener(logger,'LogUpdate',@(logger,evtData) weakThis.Handle.updateMonitor(evtData,visible));
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Error in deep.internal.train.SerialMetricManager/notifyLogUpdate (line 28)
notify(this,'LogUpdate',eventData);
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Error in deep.internal.train.MetricManager/evaluateMetricsAndSendLogUpdate (line 177)
notifyLogUpdate(this, logUpdateEventData);
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Error in deep.internal.train.setupTrainnet>iEvaluateMetricsAndSendLogUpdate (line 140)
evaluateMetricsAndSendLogUpdate(metricManager, evtData);
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Error in deep.internal.train.setupTrainnet>@(source,evtData)iEvaluateMetricsAndSendLogUpdate(source,evtData,metricManager) (line 125)
addlistener(trainer,'IterationEnd',@(source,evtData) iEvaluateMetricsAndSendLogUpdate(source,evtData,metricManager));
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Error in deep.internal.train.BatchTrainer/notifyIterationAndEpochEnd (line 189)
notify(trainer,'IterationEnd',data);
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Error in deep.internal.train.FullBatchTrainer/computeBatchTraining (line 112)
notifyIterationAndEpochEnd(trainer, matlab.lang.internal.move(data));
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Error in deep.internal.train.BatchTrainer/computeTraining (line 144)
net = computeBatchTraining(trainer, net, mbq);
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Error in deep.internal.train.Trainer/train (line 67)
net = computeTraining(trainer, net, mbq);
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Error in deep.internal.train.train (line 30)
net = train(trainer, net, mbq);
^^^^^^^^^^^^^^^^^^^^^^^^
Error in trainnet (line 51)
[varargout{1:nargout}] = deep.internal.train.train(mbq, net, loss, options, ...
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Error in LiveEditorEvaluationHelperEeditorId (line 27)
netTrained = trainnet(XData,YData,net,"mse",options);
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Error in connector.internal.fevalMatlab

Error in connector.internal.fevalJSON
7 00:00:04 5.3382e-10 1.4371e-07 0.43992 Training stopped: Gradient tolerance reached
netTrained.Layers(2)
ans =
fitCurveLayer with properties: Name: 'fitCurve' Learnable Parameters a1: 20.0007 a2: 9.9957 a3: 1.0072 a4: 49.9962 State Parameters No properties. Use properties method to see a list of all properties.
classdef fitCurveLayer < nnet.layer.Layer ...
& nnet.layer.Acceleratable
% Example custom SReLU layer.
properties (Learnable)
% Layer learnable parameters
a1
a2
a3
a4
end
methods
function layer = fitCurveLayer(args)
arguments
args.Name = "lm_fit";
end
% Set layer name.
layer.Name = args.Name;
% Set layer description.
layer.Description = "fit curve layer";
end
function layer = initialize(layer,~)
% layer = initialize(layer,layout) initializes the layer
% learnable parameters using the specified input layout.
if isempty(layer.a1)
layer.a1 = rand();
end
if isempty(layer.a2)
layer.a2 = rand();
end
if isempty(layer.a3)
layer.a3 = rand();
end
if isempty(layer.a4)
layer.a4 = rand();
end
end
function Y = predict(layer, X)
% Y = predict(layer, X) forwards the input data X through the
% layer and outputs the result Y.
% Y = layer.a1.*exp(-X./layer.a2) + layer.a3.*X.*exp(-X./layer.a4);
Y = layer.a1*(X/100) + layer.a2*(X/100).^2 + layer.a3*(X/100).^3 + layer.a4*(X/100).^4;
end
end
end
The network is very simple — only the fitCurveLayer defines the learnable parameters a1–a4. I observed that the output values are very close to those from lsqcurvefit.
Hello everyone,
I would like to share some results from my recent research on the NKTg law of variable inertia and how it was experimentally verified using NASA JPL Horizons data (Dec 30–31, 2024).
🔹 What is the NKTg Law?
The law states that an object’s tendency of motion depends on the interaction between its position (x), velocity (v), and mass (m) through the conserved quantity:
NKTg1 = x * (m * v)
Here, m * v is the linear momentum.
If NKTg1 > 0 → the object tends to move away from equilibrium.
If NKTg1 < 0 → the object tends to return to equilibrium.
This law provides a new framework for analyzing orbital dynamics.
🔹 Research Objective
Interpolate the masses of all 8 planets using the NKTg law.
Compare results with NASA’s official planetary masses on 31/12/2024.
Test sensitivity for Earth’s mass loss as measured by GRACE / GRACE-FO missions.
🔹 Key Results
Table 1 – Mass Interpolation (31/12/2024)
Planet Interpolated Mass (kg) NASA Mass (kg) Δm Remarks
Mercury 3.301×10^23 3.301×10^23 ≈0 Perfect match
Venus 4.867×10^24 4.867×10^24 ≈0 Negligible error
Earth 5.972×10^24 5.972×10^24 ≈0 GRACE confirms slight variation
Mars 6.417×10^23 6.417×10^23 ≈0 Perfect match
Jupiter 1.898×10^27 1.898×10^27 ≈0 Stable mass
Saturn 5.683×10^26 5.683×10^26 ≈0 Error ≈ zero
Uranus 8.681×10^25 8.681×10^25 ≈0 Matches Voyager 2 data
Neptune 1.024×10^26 1.024×10^26 ≈0 Perfect match
Error rate: < 0.0001% across all planets.
🔹 Earth’s Mass Variation
NASA keeps Earth’s mass constant in official datasets.
GRACE/GRACE-FO show Earth loses ~10^20–10^21 kg annually (gas escape, ice melt, groundwater loss).
NKTg interpolation detected a slight decrease (~3 × 10^19 kg in 2024), which is within GRACE’s measured range.
This demonstrates the sensitivity of the NKTg model in detecting subtle real-world changes.
🔹 Why This Matters
Accuracy: NKTg interpolation perfectly matched NASA’s planetary masses.
Conservation: NKTg1 appears to be a conserved orbital quantity across both rocky and gas planets.
Applications:
  • Real-time planetary mass estimation using (x, v) data.
  • Integration into orbital mechanics simulations in MATLAB.
  • Potential extensions into astrophysics and engineering models.
🔹 Conclusion
The NKTg law provides a novel way to interpolate planetary masses with extremely high accuracy, while also being sensitive to subtle physical changes like Earth’s gradual mass loss.
This could open up new opportunities for:
  • Data-driven planetary modeling in MATLAB.
  • Improved sensitivity in detecting small-scale variations not included in standard NASA datasets.
References:
  • NASA JPL Horizons (planetary positions & velocities)
  • NASA Planetary Fact Sheet (official masses)
  • GRACE / GRACE-FO Mission Data (Earth mass loss)
I’d be very interested in hearing thoughts from the community about:
  • How to integrate the NKTg model into MATLAB orbital simulations.
  • Whether conserved quantities like NKTg1 could provide practical value beyond astronomy (e.g., physics simulations, engineering).
Best regards,
Nguyen Khanh Tung
Yann Debray
Yann Debray
最後のアクティビティ: 2025 年 9 月 4 日 0:42

I saw this YouTube short on my feed: What is MATLab?
I was mostly mesmerized by the minecraft gameplay going on in the background.
Found it funny, thought i'd share.
Christopher Stapels
Christopher Stapels
最後のアクティビティ: 2025 年 9 月 3 日 12:42

For the www, uk, and in domains,a generative search answer is available for Help Center searches. Please let us know if you get good or bad results for your searches. Some have pointed out that it is not available in non-english domains. You can switch your country setting to try it out. You can also ask questions in different languages and ask for the response in a different language. I get better results when I ask more specific queries. How is it working for you?
Nicolas Douillet
Nicolas Douillet
最後のアクティビティ: 2025 年 9 月 2 日 13:21

Trinity
  • It's the question that drives us, Neo. It's the question that brought you here. You know the question, just as I did.
Neo
  • What is the Matlab?
Morpheus
  • Unfortunately, no one can be told what the Matlab is. You have to see it for yourself.
And also later :
Morpheus
  • The Matlab is everywhere. It is all around us. Even now, in this very room. You can feel it when you go to work [...]
The Architect
  • The first Matlab I designed was quite naturally perfect. It was a work of art. Flawless. Sublime.
[My Matlab quotes version of the movie (Matrix, 1999) ]
David
David
最後のアクティビティ: 2025 年 8 月 29 日 20:21

I’d like to take a moment to highlight the great contributions of one of our community members, @Paul, who is fast approaching an impressive 5,000 reputation points!
Paul has built his reputation the best way possible - by generously sharing his knowledge and helping others. Over the last few years, he’s provided thoughtful and practical answers to hundreds of questions, making life a little easier for learners and experts alike.
Reputation points are more than just numbers here - they represent the trust and appreciation of the community. Paul’s upcoming milestone is a testament to his consistency, expertise, and willingness to support others.
Please join me in recognizing Paul's contributions and impact on the MATLAB Central community.
owen
owen
最後のアクティビティ: 2025 年 9 月 2 日 6:06

Modern engineering requires both robust hardware and powerful simulation tools. MATLAB and Simulink are widely used for data analysis, control design, and embedded system development. At the same time, Kasuo offers a wide range of components—from sensors and connectors to circuit protection devices—that engineers rely on to build real-world systems.
By combining these tools, developers can bridge the gap between simulation and implementation, ensuring their designs are reliable and ready for deployment.
Example Use Case: Sensor Data Acquisition and Processing
  1. Kasuo Hardware Setup
  • Select a Kasuo sensor (e.g., temperature, microphone, or motion sensor).
  • Connect it to a DAQ or microcontroller board for data collection.
  1. Data Acquisition in MATLAB
  • Use MATLAB’s Data Acquisition Toolbox to stream sensor data directly.
  • Example snippet:
s = daq("ni");
addinput(s,
"Dev1", "ai0", "Voltage");
data = read(s, seconds(
5), "OutputFormat", "Matrix");
plot(data);
  1. Signal Processing with Simulink
  • Build a Simulink model to filter noise, detect anomalies, or design control logic.
  • Simulink enables real-time visualization and iterative tuning.
  1. Validation & Protection Simulation
  • Add Kasuo’s circuit protection components (e.g., TVS diodes, surge suppressors) in the physical design.
  • Use Simulink to simulate stress conditions, validating system robustness before hardware testing.
Benefits of the Workflow
  • Faster prototyping with MATLAB & Simulink.
  • Greater reliability by incorporating Kasuo protection devices.
  • Seamless transition from model to hardware implementation.
Conclusion
Kasuo’s electronic components provide the hardware foundation for many embedded and signal processing applications. When combined with MATLAB and Simulink, engineers can design, simulate, and validate systems more efficiently—reducing risks and development time.
Rizwan Khan
Rizwan Khan
最後のアクティビティ: 2025 年 9 月 12 日 11:38

With AI agents dev coding on other languages has become so easy.
Im waiting for matlab to build something like warp but for matlab.
I know they have the current ai but with all respect it's rubbish compared to vibe coding tools in others sectors.
Matlab leads AI so it really should be leading this space.
John Brown
John Brown
最後のアクティビティ: 2025 年 8 月 29 日 14:55

Function Syntax Design Conundrum
As a MATLAB enthusiast, I particularly enjoy Steve Eddins' blog and the cool things he explores. MATLAB's new argument blocks are great, but there's one frustrating limitation that Steve outlined beautifully in his blog post "Function Syntax Design Conundrum": cases where an argument should accept both enumerated values AND other data types.
Steve points out this could be done using the input parser, but I prefer having tab completions and I'm not a fan of maintaining function signature JSON files for all my functions.
Personal Context on Enumerations
To be clear: I honestly don't like enumerations in any way, shape, or form. One reason is how awkward they are. I've long suspected they're simply predefined constructor calls with a set argument, and I think that's all but confirmed here. This explains why I've had to fight the enumeration system when trying to take arguments of many types and normalize them to enumerated members, or have numeric values displayed as enumerated members without being recast to the superclass every operation.
The Discovery
While playing around extensively with metadata for another project, I realized (and I'm entirely unsure why it took so long) that the properties of a metaclass object are just, in many cases, the attributes of the classdef. In this realization, I found a solution to Steve's and my problem.
To be clear: I'm not in love with this solution. I would much prefer a better approach for allowing variable sets of membership validation for arguments. But as it stands, we don't have that, so here's an interesting, if incredibly hacky, solution.
If you call struct() on a metaclass object to view its hidden properties, you'll notice that in addition to the public "Enumeration" property, there's a hidden "Enumerable" property. They're both logicals, which implies they're likely functionally distinct. I was curious about that distinction and hoped to find some functionality by intentionally manipulating these values - and I did, solving the exact problem Steve mentions.
The Problem Statement
We have a function with an argument that should allow "dual" input types: enumerated values (Steve's example uses days of the week, mine uses the "all" option available in various dimension-operating functions) AND integers. We want tab completion for the enumerated values while still accepting the numeric inputs.
A Solution for Tab-Completion Supported Arguments
Rather than spoil Steve's blog post, let me use my own example: implementing a none() function. The definition is simple enough tf = ~any(A, dim); but when we wrap this in another function, we lose the tab-completion that any() provides for the dim argument (which gives you "all"). There's no great way to implement this as a function author currently - at least, that's well documented.
So here's my solution:
%% Example Function Implementation
% This is a simple implementation of the DimensionArgument class for implementing dual type inputs that allow enumerated tab-completion.
function tf = none(A, dim)
arguments(Input)
A logical;
dim DimensionArgument = DimensionArgument(A, true);
end
% Simple example (notice the use of uplus to unwrap the hidden property)
tf = ~any(A, +dim);
end
I like this approach because the additional work required to implement it, once the enumeration class is initialized, is minimal. Here are examples of function calls, note that the behavior parallels that of the MATLAB native-style tab-completion:
%% Test Data
% Simple logical array for testing
A = randi([0, 1], [3, 5], "logical");
%% Example function calls
tf = none(A, "all"); % This is the tab-completion it's 1:1 with MATLABs behavior
tf = none(A, [1, 2]); % We can still use valid arguments (validated in the constructor)
tf = none(A); % Showcase of the constructors use as a default argument generator
How It Works
What makes this work is the previously mentioned Enumeration attribute. By setting Enumeration = false while still declaring an enumeration block in the classdef file, we get the suggested members as auto-complete suggestions. As I hinted at, the value of enumerations (if you don't subclass a builtin and define values with the someMember (1) syntax) are simply arguments to constructor calls.
We also get full control over the storage and handling of the class, which means we lose the implicit storage that enumerations normally provide and are responsible for doing so ourselves - but I much prefer this. We can implement internal validation logic to ensure values that aren't in the enumerated set still comply with our constraints, and store the input (whether the enumerated member or alternative type) in an internal property.
As seen in the example class below, this maintains a convenient interface for both the function caller and author the only particuarly verbose portion is the conversion methods... Which if your willing to double down on the uplus unwrapping context can be avoided. What I have personally done is overload the uplus function to return the input (or perform the identity property) this allowss for the uplus to be used universally to unwrap inputs and for those that cant, and dont have a uplus definition, the value itself is just returned:
classdef(Enumeration = false) DimensionArgument % < matlab.mixin.internal.MatrixDisplay
%DimensionArgument Enumeration class to provide auto-complete on functions needing the dimension type seen in all()
% Enumerations are just macros to make constructor calls with a known set of arguments. Declaring the 'all'
% enumeration member means this class can be set as the type for an input and the auto-completion for the given
% argument will show the enumeration members, allowing tab-completion. Declaring the Enumeration attribute of
% the class as false gives us control over the constructor and internal implementation. As such we can use it
% to validate the numeric inputs, in the event the 'all' option was not used, and return an object that will
% then work in place of valid dimension argument options.
%% Enumeration members
% These are the auto-complete options you'd like to make available for the function signature for a given
% argument.
enumeration(Description="Enumerated value for the dimension argument.")
all
end
%% Properties
% The internal property allows the constructor's input to be stored; this ensures that the value is store and
% that the output of the constructor has the class type so that the validation passes.
% (Constructors must return the an object of the class they're a constructor for)
properties(Hidden, Description="Storage of the constructor input for later use.")
Data = [];
end
%% Constructor method
% By the magic of declaring (Enumeration = false) in our class def arguments we get full control over the
% constructor implementation.
%
% The second argument in this specific instance is to enable the argument's default value to be set in the
% arguments block itself as opposed to doing so in the function body... I like this better but if you didn't
% you could just as easily keep the constructor simple.
methods
function obj = DimensionArgument(A, Adim)
%DimensionArgument Initialize the dimension argument.
arguments
% This will be the enumeration member name from auto-completed entries, or the raw user input if not
% used.
A = [];
% A flag that indicates to create the value using different logic, in this case the first non-singleton
% dimension, because this matches the behavior of functions like, all(), sum() prod(), etc.
Adim (1, 1) logical = false;
end
if(Adim)
% Allows default initialization from an input to match the aforemention function's behavior
obj.Data = firstNonscalarDim(A);
else
% As a convenience for this style of implementation we can validate the input to ensure that since we're
% suppose to be an enumeration, the input is valid
DimensionArgument.mustBeValidMember(A);
% Store the input in a hidden property since declaring ~Enumeration means we are responsible for storing
% it.
obj.Data = A;
end
end
end
%% Conversion methods
% Applies conversion to the data property so that implicit casting of functions works. Unfortunately most of
% the MathWorks defined functions use a different system than that employed by the arguments block, which
% defers to the class defined converter methods... Which is why uplus (+obj) has been defined to unwrap the
% data for ease of use.
methods
function obj = uplus(obj)
obj = obj.Data;
end
function str = char(obj)
str = char(obj.Data);
end
function str = cellstr(obj)
str = cellstr(obj.Data);
end
function str = string(obj)
str = string(obj.Data);
end
function A = double(obj)
A = double(obj.Data);
end
function A = int8(obj)
A = int8(obj.Data);
end
function A = int16(obj)
A = int16(obj.Data);
end
function A = int32(obj)
A = int32(obj.Data);
end
function A = int64(obj)
A = int64(obj.Data);
end
end
%% Validation methods
% These utility methods are for input validation
methods(Static, Access = private)
function tf = isValidMember(obj)
%isValidMember Checks that the input is a valid dimension argument.
tf = (istext(obj) && all(obj == "all", "all")) || (isnumeric(obj) && all(isint(obj) & obj > 0, "all"));
end
function mustBeValidMember(obj)
%mustBeValidMember Validates that the input is a valid dimension argument for the dim/dimVec arguments.
if(~DimensionArgument.isValidMember(obj))
exception("JB:DimensionArgument:InvalidInput", "Input must be an integer value or the term 'all'.")
end
end
end
%% Convenient data display passthrough
methods
function disp(obj, name)
arguments
obj DimensionArgument
name string {mustBeScalarOrEmpty} = [];
end
% Dispatch internal data's display implementation
display(obj.Data, char(name));
end
end
end
In the event you'd actually play with theres here are the function definitions for some of the utility functions I used in them, including my exception would be a pain so i wont, these cases wont use it any...
% Far from my definition isint() but is consistent with mustBeInteger() for real numbers but will suffice for the example
function tf = isint(A)
arguments
A {mustBeNumeric(A)};
end
tf = floor(A) == A
end
% Sort of the same but its fine
function dim = firstNonscalarDim(A)
arguments
A
end
dim = [find(size(A) > 1, 1), 0];
dim(1) = dim(1);
end
Yann Debray
Yann Debray
最後のアクティビティ: 2025 年 8 月 26 日 16:24

Hello MATLAB Central, this is my first article.
My name is Yann. And I love MATLAB.
I also love HTTP (i know, weird fetish)
So i started a conversation with ChatGPT about it:
gitclone('https://github.com/yanndebray/HTTP-with-MATLAB');
cd('HTTP-with-MATLAB')
http_with_MATLAB
data = struct with fields:
data: [1×1 struct]
btcPrice = 1.0949e+05
age = struct with fields:
count: 27549 name: 'Yann' age: 51
Error using loadenv (line 27)
Unable to find or open '.env'. Check the path and filename or file permissions.

Error in http_with_MATLAB (line 18)
loadenv(".env")
^^^^^^^^^^^^^^^
I'm not sure that this platform is intended to clone repos from github, but i figured I'd paste this shortcut in case you want to try out my live script http_with_MATLAB.m
A lot of what i program lately relies on external web services (either for fetching data, or calling LLMs).
So I wrote a small tutorial of the 7 or so things I feel like I need to remember when making HTTP requests in MATLAB.
Let me know what you think
Yann Debray
Yann Debray
最後のアクティビティ: 2025 年 8 月 28 日 10:38

Hello MATLAB Central community,
My name is Yann. And I love MATLAB. I also love Python ... 🐍 (I know, not the place for that).
I recently decided to go down the rabbit hole of AI. So I started benchmarking deep learning frameworks on basic examples. Here is a recording of my experiment:
Happy to engage in the debate. What do you think?