Contenido principal

Resultados de

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)
  • 📂 Full paper (with detailed tables & methodology): [Provide your link – e.g. Google Drive, ResearchGate, or GitHub]
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
Última actividad el 4 de Sept. de 2025 a las 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
Última actividad el 3 de Sept. de 2025 a las 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
Última actividad el 2 de Sept. de 2025 a las 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
Última actividad el 29 de Ag. de 2025 a las 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.
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
Última actividad el 2 de Sept. de 2025 a las 5:50

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
Última actividad el 29 de Ag. de 2025 a las 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
Última actividad el 26 de Ag. de 2025 a las 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
Última actividad el 28 de Ag. de 2025 a las 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?
Jerry
Jerry
Última actividad el 22 de Ag. de 2025 a las 10:45

Im using stm32h735g-dk and i was thinking to start model based development using simulink in matlab.
I already done a cluster prototype using touchgfx and stm32cube ide
now i need to shift from cube ide to simulink using same gui is it possible??
If its posssible how will i integrate with simulink
i have already licenced version and stm embedded packages on simulink and embedded coder
can anyone help me with a guidance how to integrate without using cube ide
Harel
Harel
Última actividad el 25 de Ag. de 2025 a las 13:11

Hi,
I have some problem, I want to upload my data that sample rate at 500HZ, every sevral seconds.
My data include 12 bytes, and it measure 500HZ, for example for 15 seconds I coolect 15*500*12 = 84KB.
Can I upload this data to ThingSpeak? It is possible to use with Free acount (I am student and this is my project)
How can help me..
Ceci
Ceci
Última actividad el 26 de Ag. de 2025 a las 17:59

I designed and stitched this last week! It uses a total of 20 DMC thread colors, and I frequently stitched with two colors at once to create the gradient.
Matt Nickels
Matt Nickels
Última actividad el 22 de Ag. de 2025 a las 22:15

I can not understand why Plot Browser was taken away in latest Matlab... I use Plot Browser all of the time! Having to find and click the particular line I want in a plot with a lot of lines is way less convenient than just selecting it in the Plot Browser. Also, being able to quickly hide/show multiple lines at once with the plot browser was so helpful in a lot of cases. Please bring Plot Browser back!!!! Please reply with support for this if you feel the same as I do!
Jan Studnicka
Jan Studnicka
Última actividad el 20 de Ag. de 2025 a las 20:16

When you compare MATLAB Plot Gallery with matplotlib gallery, you can see that matplotlib gallery contains a lot of nice graphs which are easy to create in MATLAB but not listed in MATLAB Plot Gallery.
For example, "Data Distribution Plots" section in the MATLAB Plot Gallery includes example for pie function instead of examples for piechart and donutchart functions, etc.
Adam Danz
Adam Danz
Última actividad el 19 de Ag. de 2025 a las 18:06

In the latest Graphics and App Building blog article, documentation writer Jasmine Poppick modernized a figure-based bridge analysis app by replacing uicontrol with new UI components and uifigure, resulting in cleaner code, better layouts, and expanded functionality in R2025a.

https://blogs.mathworks.com/graphics-and-apps/2025/08/19/__from-uicontrol-to-ui-components

This article covers the following topics:

Why and when to move from uicontrol and figure to modern UI components and uifigure.

How to replace uicontrol objects with equivalent UI component functions (uicheckbox, uidropdown, uispinner, etc.).

How to update callback code to match new component properties and behaviors.

How to adopt new UI component types (like spinners) to simplify validation and improve usability.

How to configure existing components with modern options (sortable tables, auto-fitting columns, editable data).

How to apply visual styling with uistyle and addStyle to make apps more user-friendly.

How to use uigridlayout to create flexible, adaptive layouts instead of manually managing positions.

The benefits of switching from figure to uifigure for app-building workflows.

A full before-and-after example of modernizing an existing app with incremental, practical updates.

In our large open-source MATLAB Central community, there are many long-term excellent user groups. I really want to know why you have been using MATLAB for a long time, and what are its absolute advantages?
I have been using MATLAB for a long time, and there are several reasons for that:
  1. Fast ramp-up in unfamiliar domains: When I explore an unfamiliar application area or a new topic, MATLAB helps me quickly locate the canonical methods and example workflows. Its comprehensive, professional documentation — along with the related-topic links typically provided at the end of each page — makes it easy to get started intuitively and saves a lot of time that would otherwise be spent hunting for foundational knowledge across the web.
  2. A relatively cutting-edge yet reliable technical path: MATLAB’s many toolboxes evolve with the field. While updates aren’t always absolutely bleeding-edge, they generally offer approaches that balance modernity and proven reliability. This reduces the risk of wasting time on obscure or unstable algorithms and helps me follow a pragmatic, well-tested technical direction.
  3. Strong community and technical support: When I encounter a problem I first post on forums like MATLAB Answers and thoroughly investigate the issue myself. If I find a solution, I publish it to contribute back — which deepens my own understanding and helps others. If I can’t solve it alone, experienced community members often respond within hours. As a last resort, MathWorks’ official support is available and typically conducts an in-depth investigation into specific cases to help resolve the issue.
  4. ......
Also, most individuals have limited time and technical bandwidth, diving deeply into a single, narrow area can be hard to pull back from unless you are committed to that specific direction. For cutting‑edge, highly specialized research it’s often necessary to combine MATLAB with other languages (e.g., Python, C/C++) to go further.
There is a communication regarding "How can I set the text font style of a Data Cursor object interactively on a plot?". But I am not clear on the answer found in this link:
https://www.mathworks.com/matlabcentral/answers/95968-how-can-i-set-the-text-font-style-of-a-data-cursor-object
I do not know how and where to put the recommended commands. Would you please clarfity and give me more details?
Thank you.
David
David
Última actividad el 14 de Ag. de 2025 a las 14:07

Worth the wait: seven new online training courses and one new learning path were released with 25a, covering topics in Controls, Electrification, and Physical Modeling. This release also brings new functionality to support interactions across both MATLAB and Simulink within a single course, beginning with the new Controls courses below: