
r/matlab

A 4K N-body simulation of 100k particles simulating some merger events
youtube.comany suggesttions for control engineering?
im a third year electrical and electronics enginnering student. i really enjoyed the control course and im trying to learn the control playling in MATLAB youtube channel. i would be very grateful for any suggestions for pursing this field
Discussion: Interactive 3D visualization for math learning
I apologize if this does not fit the subreddit.
I'm currently taking a course in linear algebra and rational mechanics, and I want to visualize what I'm learning, because that makes me understand things much better. I tried a few different programs, with not a lot of success. The first one I thought of was Geogebra, but it's a little too basic for what I'm doing, so I tried mathematica, which was great for a while, until I created a complex scene in 3D and it started crashing. I asked an LLM for suggestions and it told me I should try pyvista, which is a python library for 3D visualization. Honestly, there are so many options that I just want to know if somebody has figured this out already.
What I'm looking for is a quick, script-based visualization tool for 3D geometry, with an interactive scene that I can modify real-time via code or commands. The problem with mathematica, for example, is that you can't really interact with a scene (except for the very limited manipulate[] command): every time you modify something in the code, you have to re-run the scene. It's not really designed for my use-case. The same goes for pyvista, really, as well as matlab (although I haven't dug into these a lot).
I'm sure that for those of you that work in the field, you often need to visualize stuff quickly, play with numbers, do a visual rundown of what you're doing. Sometimes pen and paper is just not enough. So: what do you guys use?
Help with implementing a PI controller in Simulink
I don't have a background in EE and I'm having trouble getting a PI controller working in MATLAB, and I can't for the life of me figure out what I'm doing wrong. I feel like I have a fundamental problem in my understanding and any help would be greatly appreciated.
I made two skill files for Claude that turned my engineering ideas into buildable steps
Disclaimer: What you are seeing is a polished version of my draft, polished by Claude.
I made two skill files for Claude
- is Project Intelligence Layer (IL). You tell it your goal, it breaks it into steps in real build order — not textbook order, actual order.
Four steps: understand, explain, break into parts, produce output.
The output is ready to use directly MATLAB simulation prompt, Keil C structure, Proteus steps, whatever your target platform is.
- Aizen Tutor Depth calibrator with 9 levels inspired by chess ranking. It controls how deep the explanation goes at each step. So the loop doesn't over-explain what you already know.
Together they form a ReAct loop — Reason → Act → Observe → Correct → Repeat. But with depth control at each step.
Tested on: MATLAB simulations, college report making, image prompting in Gemini Nano, AI music, Google AI Studio coding prompts (reduced hallucination), cv making, self test
i think both skill is works on any cause only need to calibrate accrding use caus
anyone tell me how to solve thos problems
problems:
currently i using both as chatbot i try to switch to agentic
Both skills consume a lot of tokens in one chat
i not using this in any paid models
Opinions and reviews on MATLAB 2026a?
Hey y'all. I noticed 2026a just released two days ago. For people who installed and tried it, what do you think? Is it "broken" and unfinished similar to 2025a, or is it reliable enough to upgrade to from 2025b? I am tempted by the major Simulink improvements. I would like to hear from you guys.
External analog input for RT simulation in Simulink
Hi there,
I built a car model in Simulink as a study project, and I'm looking to upgrade it into a simple simulator.
My model expects steering, brake and throttle inputs, and outputs car position, speed, orientation, etc... I also use Simulink 3D Animation environment, and so far I've been able to drive the car using dashboard knobs and slider, so the next step would be to plug in potentiometers linked to a simple sim racing setup to actually drive it.
From my research the best option seems to be using the Analog Input block from Simulink Desktop Real-Time, but I struggle to find resources to pick the right hardware. I need something very simple (3 analog inputs only), but I don't exactly know where to start.
Any advice on how to proceed, tips, experience feedback, and hardware reccomandation would be super useful! Thanks :)
Inquiry about Autonomous Surface Vehicle Simulation (MATLAB/Simulink)
I am a student with a strong interest in autonomous surface vehicles and control systems.
At the moment, I am working on modeling the dynamic motion of a vessel. My work includes:
Dynamic modeling of the ship
Implementation of a PID controller combined with fuzzy logic
Application of the ILOS (Integral Line-Of-Sight) guidance algorithm
Point-to-point trajectory tracking
In addition, I have been studying key references such as Handbook of Marine Craft Hydrodynamics and Motion Control and Guidance and Control of Ocean Vehicles by Thor I. Fossen to strengthen my theoretical foundation.
However, I still feel that my understanding is limited, especially in terms of improving control performance and system stability in more complex scenarios.
If possible, I would greatly appreciate any advice, learning resources, or guidance you could share regarding:
What resources (books, papers, or courses) you found most helpful when learning this topic
How you approached self-learning in autonomous vessel simulation and control
Improving simulation accuracy
Advanced control strategies for autonomous vessels
Best practices when working with MATLAB/Simulink in this field
Thank you very much for your time and for sharing such valuable content. I look forward to your response.
Best regards,
How much of a difference in content is R2026a from R2025a?
With R2026a coming out yesterday. I downloaded pretty much the same toolboxes that I originally had on the R2025a (version that is on my laptop) onto R2026a (done from scratch) and the installation took like an hour and a half as it was around 25-30 GB in total. It seems (based on my observation) that the 2 versions are very similar.
What specific features did Mathworks upgrade in this particular version (r2026a)? And also is dark mod a feature now? I'm not sure if you could use dark mode in the 2025a/b version.
BTW I use the student license from my university (not sure if its limited on what it can do) as I didn't pay out of pocket for the subscription.
"Agents are just LLM + loop + tools" - I built it with MATLAB + Ollama
This is a lightweight AI coding agent built entirely in MATLAB. The core part is just a few lines of code.
chat = openAIChat(systemPrompt, Tools=tools); % configure the LLM
messages = messageHistory; % conversation history
while true % agentic loop
[text, response] = generate(chat, messages); % call the LLM
messages = addResponseMessage(messages, response);
if isempty(text)
results = run_tools(response); % execute requested tools
messages = addToolMessage(messages, results);
else
disp(text); % no more tool calls — done
break
end
end
That's it.
In practice, this is way too slow on my machine - no powerful GPU - to be practical (I sped up the video), and you are better off using frontier models. But if you have a very powerful machine and are willing to run local LLMs via LLMs with MATLAB Add-on, it's possible.
Help
I wanna save my matlab work and send it via mail how can i do that
How to develop 802.15.4 phy, is there an open source or matlab driven flow or similar.
reddit.commatlab website/online documentations become dark mode
how to turn it back to light mode?
The matlab dark mode is hard to read and ugly af. they really need to hire a UI guy.
simplified PV model
Hello,
I am currently writing my bachelor’s thesis and I would really appreciate some guidance.
My topic is related to voltage profile support in a medium-voltage distribution network in Simulink. The main focus is not on making the solar plant itself as detailed as possible, but rather on building a reasonable simplified solar power plant model that is still more realistic than just using a plain DC power source.
What my professor expects from me is roughly this:
- use a standard medium-voltage distribution test feeder in Simulink,
- add a solar power source to the network,
- study how it affects voltage profile,
- study active and reactive power support,
- and later vary line r/X ratio and compare the results.
At the moment I am using an IEEE 34-node feeder model in Simulink.
My problem is that I first tried a more detailed structure with blocks such as:
- PV Array
- DC link
- Universal Bridge
- filter
- PWM Generator
but the simulation becomes very slow, especially when I try switching-based inverter modeling.
So my main question is:
For this type of thesis, what is a good simplified PV plant model in Simulink?
I do not need a highly detailed solar cell study. I just need a simplified but meaningful block structure that still represents a solar plant better than a simple DC source, and that can be connected to a medium-voltage feeder for voltage and reactive power studies.
I will attach screenshots of my current model, including the PWM Generator block, because that is one of the places where I got stuck and where the model started taking too long to simulate.
Sorry if this is a basic question — I am honestly not very skilled in Simulink yet, and I am trying to build the model step by step in a way that is still acceptable for a thesis.
Thank you very much for any advice.
Neural Network Toolbox replacement (silly question)
Need to start using Matlab for image analysis and the instructions from when the process was developed used Matlab Neural Network Toolbox ( many years ago)
Just wonder what has replaced this toolbox:
Deep Learning Toolbox or
statistics and Machine Learning Toolbox?
Thanks, and hopefully I'll become more versed in Matlab as I use it more.
Self-Reciprocating Cylinder System Won't Reciprocate
Hello, I've been trying to model a self-reciprocating hydraulic system with SimScape Fluids and cannot get the DCV to shift once the cylinder fully extends. Can someone please tell me what I'm doing wrong? I can only get the position to change if the DCV is activated by a constant input, not the actuators. Please ignore the spaghetti sensors; I was throwing them everywhere out of frustration.
Simulink inverter output is square instead of sine wave (SPWM issue)
Hi everyone,
I'm building a PV system in MATLAB Simulink with the following components:
- PV array (12 series × 2 parallel, ~650W modules)
- MPPT (Perturb & Observe)
- Boost converter
- Battery (DC bus)
- H-bridge inverter with SPWM control
The PWM generation is based on comparing a sine wave (50 Hz) with a sawtooth carrier (~10 kHz).
The issue:
The inverter output is not a sine wave. Instead, I'm getting a square/pulsed waveform (~0–50V), even after adding an LC filter.
Parameters:
- PV: Vmp ≈ 48V per module
- DC bus: expected ~350V
- L filter: ~5 mH
- C filter: ~20 µF
- Load: resistive
I suspect one of the following:
Incorrect H-bridge gate signal configuration
LC filter connection issue
Wrong measurement point
I've attached:
- Simulink block diagram
- Output waveforms
- PV array parameters
What am I most likely doing wrong?
Thanks!
Implementing adaptive robust control for an electrohydraulic servo actuator in Simulink. How are people actually doing it?
​
Hi everyone,
I’m working on a project involving tracking control of a six-DOF multi-axis coupled machine driven by electrohydraulic actuators.
At the moment, I already have a baseline control structure with very good tracking accuracy. it comprises of an outer loop control and an inner loop control for the actuator side. What I want to do next is improve the actuator control law by adding an adaptive robust control term, based on a paper I’m referencing.
The problem is that the adaptive robust law in the paper is pretty computationally heavy, at least from the way it is presented mathematically, and I’m trying to figure out how people actually implement this in practice, especially in Simulink.
So I wanted to ask people who have worked on electrohydraulic servo systems or similar nonlinear actuator control problems:
When implementing adaptive robust control laws, do you usually build them using standard Simulink blocks?
Or do you normally put the heavy mathematics inside MATLAB Function blocks?
For parameter adaptation, projection laws, robust terms, pressure dynamics, valve flow nonlinearities, etc., what parts are usually done with blocks and what parts are better handled in code?
Are there practical tricks for reducing computational burden while keeping the controller faithful to the paper?
If you implemented something similar, what parameters or terms turned out to matter most in practice?
I’m especially interested in hearing from anyone who has implemented this on a real or realistic electrohydraulic servo model, not just in theory.
also the current baseline model runs quite slowly so i am concerned about adding more blocks to the model.
Thanks.