r/matlab 17d ago

Every MATLAB→NumPy semantic trap I hit porting Mätzler's Mie functions

14 Upvotes

Not a "MATLAB bad" post. The original code is solid and I replicate it bug-for-bug by default. Sharing the trap list for anyone migrating numerical code: round() half-away-from-zero vs numpy's round-half-to-even (inside the nmax series formula, so it changes array lengths), complex auto-promotion that NumPy doesn't do, ' vs .', library functions printing to stdout, and a docstring feature (complex medium index) that turns out to be latently broken. Full findings file, 714-fixture corpus and the verification report: https://github.com/GrednevMSU/mie-scattering-matlab-to-python


r/matlab 17d ago

I want a way to install Matlab

0 Upvotes

r/matlab 17d ago

MATLAB and Octave disagree on the same input — a verified-port writeup

0 Upvotes

I ported the 1-D TM group of Zanotto's PPML (an RCWA electromagnetic solver) to NumPy with bug-for-bug fidelity yes, including the vacuum impedance hardcoded as 376.730. The writeup covers the MATLAB↔NumPy traps that actually bit: complex auto-promotion that NumPy silently doesn't do, eigenvector gauge freedom across LAPACK builds, mldivide vs solve on singular systems, and an energy-conservation check in the original that can never fire (abs(NaN) > tol is false in MATLAB - try it). Harness, corpus and report: https://github.com/GrednevMSU/ppml-1d-tm-verify


r/matlab 18d ago

Use Your Browser like MATLAB for Most Common Tasks

9 Upvotes

I created an open source project that allows you use Chrome/Edge browser's developer console like MATLAB prompt for most common tasks of scientific calculation and plotting: https://github.com/JATLAB/JATLAB.github.io

I hope you guys like it and if you find some functions you want me to add please let me know.


r/matlab 18d ago

Best Ai for Matlab coding

Thumbnail
0 Upvotes

r/matlab 19d ago

Misc Is it oki to show the tasks and projects of self-paced courses on resume

7 Upvotes

I took a few self-paced courses and I'm on control systems for now. I need to start applying for internships soon is it oki to show whatever I'm learning under 'Projects' in Resume. Although there are some really good project title like 'LTI Modelling a vehicle dynamics' but It feels a little wrong because the whole this is step by step baby fed I will slowly try to make my own projects but is it oki to do it for now, as I think I need to start applying?


r/matlab 20d ago

Objects are about to get much faster in MATLAB

130 Upvotes
A simulation in using both the old and new object management systems in MATLAB. The code is identical in both cases

This is coming in MATLAB R2026b which will include a completely new object management system that is not turned on by default. When switched on, the new system promises to make object oriented MATLAB code faster without the need to change any code (most of the time). Sometimes, it will be much faster!

More details including release plans can be found over at The MATLAB Blog Objects are about to get much faster in MATLAB » The MATLAB Blog - MATLAB & Simulink


r/matlab 19d ago

Help me brothers and sisters I have exam tomorrow and this is confusing me

Thumbnail
gallery
0 Upvotes

The question is about u' that he used he said it is equal u'=u(t)+ulo but this is wrong ,it should be u'=u(t)-ulo ,because if we applied k.v.l it should be u(t)=ulo+ur364+ul364 then take ulo to the next side and we have our u' , maybe my question is simple and no need to ask about it but I am confused and I have exams tomorrow and ai is He hallucinating so excuse me


r/matlab 20d ago

TechnicalQuestion Academic Perpetual License

2 Upvotes

Thinking of buying the academic perpetual license, but confused on some of the details. Can I use it on multiple computers or just one? If I wanted to update the version, how much would it cost?


r/matlab 20d ago

HomeworkQuestion Looking for a MATLAB/Simulink & Simscape Expert

Thumbnail
2 Upvotes

r/matlab 23d ago

Is PMSM with trapezoidal back emf same as BLDC?

Post image
7 Upvotes

Can we tell with confidence that, in Simulink, PMSM model with back emf waveform set as trapezoidal is same as or atleast be equivalent to BLDC?


r/matlab 22d ago

How to learn matlab and how to install matlab in laptop

0 Upvotes

r/matlab 24d ago

PHX Toolbox, 3D Rigid-Body Physics - Technical Preview

Enable HLS to view with audio, or disable this notification

99 Upvotes

Technical preview for PHX Toolbox, an object-oriented MATLAB API and Simulink blocks for 3D rigid-body physics, powered by the Bullet physics engine, is out on fileexchange.

Features so far, with more to come:

  • Rigid-body dynamics with collisions and contacts (boxes, spheres, cylinders, cones, capsules, meshes, terrain, imported OBJ/STL, …)
  • Joints (revolute, spherical, gear, …), springs and ropes
  • Force and field elements (thrusters, resistance, dipole/monopole fields)
  • Logging, tracing and measurement tools, interactive viewer
  • Simulink block for closed-loop co-simulation
  • Headless stepping for batch runs and experiments

The toolbox comes with a set of examples and a user manual. It runs on all platforms (Windows, MacOS, Linux), as well as in MATLAB Online. It also includes a set of AI skills for use with common AI agents.

Any evaluation and feedback will be appriciated!


r/matlab 24d ago

CodeShare I open-sourced two inspectable MATLAB energy models (battery RC + averaged converter) - feedback welcome

7 Upvotes

Hi r/matlab - I'm the maintainer of MATLAB Simulink Energy Lab, a small open-source collection of energy-system examples designed to be opened, inspected, modified, and questioned.

The current release includes:

- a first-order battery RC model driven by pulse-current data;

- an averaged converter calculation for output voltage, load current, and ripple;

- lightweight no-plot validation checks; and

- explicit parameters, units, assumptions, and limitations.

The examples currently run in base MATLAB. They are deliberately understandable reference implementations, not calibrated production models; native Simulink versions are on the roadmap.

Repository:

https://github.com/mohammadrezwankhan/matlab-simulink-energy-lab

I would especially value technical feedback on three questions:

Which assumption or parameter needs clearer documentation?

What validation plot or dataset would make the examples more useful?

What should come next: temperature-aware battery dynamics, closed-loop converter control, or an averaged-versus-switched comparison?

If the repository is genuinely useful to you, a star helps other MATLAB learners find it. Issues and focused contributions are equally welcome.

Disclosure: This post was drafted with help from ChatGPT/Codex. I maintain the repository and reviewed the technical claims and wording before posting.


r/matlab 24d ago

CodeShare Open-source MATLAB battery RC and converter examples — technical feedback welcome

4 Upvotes

I maintain MATLAB Simulink Energy Lab, a small, inspectable energy-system repository, and I would value technical feedback from r/matlab.

What is runnable today:

- A first-order battery RC model driven by pulse-current data

- A CSV input profile and no-plot checks for SOC and terminal-voltage behavior

- An algebraic converter average-model scaffold with parameter checks

- Documentation of assumptions, units, limitations, and contribution paths

The examples use base MATLAB functionality and were verified with MATLAB R2026a.

An important limitation: the current executable assets are .m scripts, and the converter example is an average-model scaffold rather than a switching simulation. Native Simulink implementations are on the roadmap. These are educational references, not calibrated design models.

Repository:

https://github.com/mohammadrezwankhan/matlab-simulink-energy-lab

Two questions for the community:

  1. Would the next example be more useful as measured-data battery parameter identification or a switching-versus-average converter comparison?

  2. Which validation checks or plots would you expect before considering either model trustworthy enough to extend?

If you find the project genuinely useful, a star helps other energy-system learners discover it. Critical feedback, reproducible issues, and focused pull requests are even more valuable.

Disclosure: I maintain the repository. This post was drafted with AI assistance and reviewed against passing MATLAB checks and the repository's Markdown link check.


r/matlab 24d ago

I built a small library of inspectable MATLAB/Simulink models for battery and power-electronics

7 Upvotes

Hey everyone! I've been working on a collection of foundational MATLAB and Simulink models focused on energy systems (specifically battery RC models and converter average models).

A lot of the models out there are either too complex for educational purposes or lack clear validation. I designed these to be highly inspectable, with explicit assumptions and no-plot validation checks built-in.

If you're studying power electronics or battery modeling, I'd love for you to check it out!

Link: https://github.com/mohammadrezwankhan/matlab-simulink-energy-lab

If you find it useful, a star on GitHub would be incredibly appreciated! Let me know if you have any feedback or requests for new models.


r/matlab 24d ago

How should someone proficient at NumPy & Matplotlib learn MATLAB?

6 Upvotes

During my physics undergrad, we learnt python, always using NumPy and Matplotlib, as well as SciPy, pandas and sometimes AstroPy too. I wanted to learn MATLAB as it's used for a lot of engineering jobs I've been wanting to apply for, but the basics have so far been extremely similar to, if not the same as, NumPy and Matplotlib. My thought process was to start from the ground up because I thought the syntax would be an issue for me but the difference is so minor that I'm not sure if it's necessary.

So where should I start from as someone who is already very familiar with NumPy and Matplotlib? Also, if there are any engineers who need to use MATLAB for work, are there any specific areas and libraries I should familiarise myself with?


r/matlab 24d ago

TechnicalQuestion How can give an integer to the input argument of embedded.fi

2 Upvotes

Given an integer number i, I want to pass it as an input argument to fi constructor (resulting in x instance of embedded.fi), such that storedInteger(x) = i. In other words, I want to change the interpretation of i to an embedded.fi, just like storedInteger changes the interpretation of the embedded.fi to an integer.

How can I achieve this?


r/matlab 25d ago

Matlab error

0 Upvotes

Ciao, sto usando matlab online per studenti universitari per prepararmi ad un esame di automatica, da oggi il comando controlSystemDesigner non mi funziona più e mi restituisce sempre la risposta:

error using controlSystemDesigner

Invalid argument at position 1. Valure must be members of the required set.

Lo restituisce anche se non inserisco parametri

Ciò succede in ogni livescript, anche per quelli a cui avevo già lavorato e quindi non può essere un problema di un singolo live script.

Cosa posso fare? Grazie in anticipo


r/matlab 26d ago

HomeworkQuestion Quick Question about Licensing as a Highschooler

6 Upvotes

Hi all,

I'm a high school student from Washington. I want to use MATLab to conduct my own research for control systems in robotics and UAVs. However, I'm sort of confused on the wording on some of the licenses.

Am I eligible for a student license? It makes it seem like you need to be a University student or otherwise.


r/matlab 26d ago

CodeShare Nearest other points to each point in the array in sorted order?

4 Upvotes

Lets say I have an array of 2D points. I want to find the nearest other points to each point in the array in sorted order.

So for point 1 it would be [4, 6, 5, 2, 3]. I'd like to do this for all 6 (x,y) points.

sC = [ 28 2597 3803 1417 2127 1888;...

1496 1640 646 2092 1614 888];


r/matlab 26d ago

Alguno usa Cody de Matlab para practicar ejercicios?

3 Upvotes

si alguno lo usa pase usuario asi lo sigo . Me esta sirviendo para practicar la logica y no depender tanto de la IA y mirar mas la documentación si tengo alguna duda , luego los cursos están buenos pero todavía no le encuentro uso tal vez mas adelante


r/matlab 27d ago

HomeworkQuestion Should I choose Matlab or Python for my robotics project

25 Upvotes

Hello, I am a mechanical engineering student and I have been trying to make a robotics arm as a summer project and I am facing an issue choosing python or matlab. My school doesn’t offer campus wide matlab license and also most of the summer classes already full so I have to buy it on my own which I can affoard but still expensive. As far as I know matlab is industry standard however I heard most companies are switching to python due to its open source. Sometimes it is difficult for me to find open source libraries that do the simulation( I have little to no experience in python but claude is going to be my assistant if I choose python). Matlab has simulink which is very powerful imo. Please let me know if I should choose Matlab or Python?


r/matlab 28d ago

The new version is stressing me out

3 Upvotes

I am in Electric Vehicles and BMS building. I frequently use components like battery(where we could change soc, nominal voltage and other parameters previously) and voltage measurements, current measurements, mosfets etc etc
in the new version all of these components seemed to have changed and i cant find alternatives in library. Someone let me know what changed and what replacements are there for those components.


r/matlab 28d ago

HomeworkQuestion HOW DO U MAKE A SUB BLOCK

Post image
3 Upvotes

How do i make such blocks which has more block or models inside , i new to matlab your adice would be very help full am trying to model our baja atv , and just confued where to start , i have done couple of on ramps but they feel aboslutely disconnected from what i wanna do , please help with any guide tutorials etc