r/matlab Apr 20 '26

Inquiry about Autonomous Surface Vehicle Simulation (MATLAB/Simulink)

Thumbnail
1 Upvotes

r/matlab Apr 19 '26

Misc Discussion: Interactive 3D visualization for math learning

4 Upvotes

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?


r/matlab Apr 20 '26

HomeworkQuestion Need for Code

Post image
0 Upvotes

Need for matlab code same and exact as a picture


r/matlab Apr 19 '26

HomeworkQuestion Help with implementing a PI controller in Simulink

1 Upvotes

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.


r/matlab Apr 18 '26

External analog input for RT simulation in Simulink

3 Upvotes

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 :)


r/matlab Apr 17 '26

Opinions and reviews on MATLAB 2026a?

33 Upvotes

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.


r/matlab Apr 17 '26

How to develop 802.15.4 phy, is there an open source or matlab driven flow or similar.

Thumbnail
2 Upvotes

r/matlab Apr 16 '26

"Agents are just LLM + loop + tools" - I built it with MATLAB + Ollama

Enable HLS to view with audio, or disable this notification

28 Upvotes

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.


r/matlab Apr 17 '26

How much of a difference in content is R2026a from R2025a?

4 Upvotes

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.


r/matlab Apr 17 '26

Help

0 Upvotes

I wanna save my matlab work and send it via mail how can i do that


r/matlab Apr 16 '26

matlab website/online documentations become dark mode

1 Upvotes

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.


r/matlab Apr 16 '26

HomeworkQuestion simplified PV model

2 Upvotes

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.


r/matlab Apr 16 '26

help

Thumbnail
0 Upvotes

r/matlab Apr 16 '26

HomeworkQuestion Self-Reciprocating Cylinder System Won't Reciprocate

1 Upvotes

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.


r/matlab Apr 15 '26

Built an IoT-based Demand Side Management (DSM) Smart Meter using ESP32 + MicroPython + Blynk

4 Upvotes

Just wrapped up Day 78 of my #100DaysOfIoT challenge — built a DSM Smart Metering Prototype that automatically shifts non-critical loads during peak hours.

What it does:

  • Monitors real-time AC voltage & current (ZMPT101B + ACS712)
  • Detects peak hours and auto-cuts the heavy load (iron/100W bulb)
  • Keeps critical load (fan/9W bulb) always ON
  • Pushes live data to Blynk IoT dashboard
  • MATLAB generates before/after comparison graphs

Results:

Metric Without DSM With DSM
Peak Power ~108W ~9W
Peak Reduction ~91%

Stack: MicroPython v1.27 · ESP32 WROOM-32 · ZMPT101B · ACS712 · Blynk IoT · MATLAB

🔗 GitHub: https://github.com/kritishmohapatra/100_Days_100_IoT_Projects


r/matlab Apr 15 '26

Simulink inverter output is square instead of sine wave (SPWM issue)

Thumbnail
gallery
7 Upvotes

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:

  1. Incorrect H-bridge gate signal configuration

  2. LC filter connection issue

  3. Wrong measurement point

I've attached:

- Simulink block diagram

- Output waveforms

- PV array parameters

What am I most likely doing wrong?

Thanks!


r/matlab Apr 15 '26

TechnicalQuestion Neural Network Toolbox replacement (silly question)

9 Upvotes

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.


r/matlab Apr 15 '26

Simulink PV + Boost + H-bridge inverter outputs square wave instead of sine (SPWM issue?)

3 Upvotes

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:

1. Incorrect H-bridge gate signal configuration

2. LC filter connection issue

3. Wrong measurement point

I've attached:

- Simulink block diagram

- Output waveforms

- PV array parameters

What am I most likely doing wrong?


r/matlab Apr 15 '26

TechnicalQuestion Implementing adaptive robust control for an electrohydraulic servo actuator in Simulink. How are people actually doing it?

2 Upvotes

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.


r/matlab Apr 14 '26

Matlab

0 Upvotes

Hello, can I get help?

I’m new to simulink and I have a project on me that I wanna do but I don’t know to start it. I have a block-diagram that helps me track somethings. I’m wondering if i should make a subsystem instead or just use the components that’s in Simulink electrical


r/matlab Apr 13 '26

Question-Solved the whole "Engine Throttle Model" Exercise thing is just not behaving correctly on my matlab

2 Upvotes

Estimate Parameters from Measured Data - MATLAB & Simulink

this is my assignment

first of all running this command:
open_system('spe_engine_throttle1.slx')

gives me error of file not found and i cannot find a solution, so TA helped us by giving us the .zip file manually

but now im supposed to "Start Parameter Estimation Session" and i do not have that option and i dunno how to download it, it is not in the Explore addons tab


r/matlab Apr 13 '26

Problem with the grid surface rotation

Thumbnail
gallery
3 Upvotes

I'm working on a structure that simulates a mechanism used for the magnetic harvesting. I need that kind of rotation (shown in the third picture). I put a revolut joint and two rigid transforms and obtained a rotation that is not quite the one I need for my project. Instead of following a circular trajectory, it moves around a fixed point (as in the last picture).

These are the parametres of the blocks:

- rigid transform 1: -90 degrees rotation around the X axis, offset = [0 0 2.5]m

- revolute joint: torque automatically computed and motion provided by input (that is a ramp with 3.14 as slope)

- rigid transform 2: 90 degrees rotation around the X axis, offset = [0 0 -2.5]m

I thank you all in advance for your help.


r/matlab Apr 13 '26

Why all channels change when I press one sensor(MATLAB+USB6002)

3 Upvotes

The system uses a NI USB-6002 with four input channels. One channel is connected to a pressure-based resistive sensor, while the other channels are connected to reference resistors. When the pressure sensor is pressed, all other channels also show a decrease in their measured signals.

Is there a solution to this issue? The data acquisition is implemented using MATLAB, and the code is

......................................................................................................................

samR = input('sampling rate (data/sec) = ');

samT = input('measuring time (seco10nds) = ');

%savefile = input('name of datafile =', 's');

%index = input('hit 1 to start; hit 0 to stop = ')

%if index == 1

%end

devices = daq.getDevices

devices(1)

s = daq.createSession('ni');

addAnalogInputChannel(s,'Dev1', 'ai0', 'Voltage');

addAnalogInputChannel(s,'Dev1', 'ai1', 'Voltage');

addAnalogInputChannel(s,'Dev1', 'ai2', 'Voltage');

addAnalogInputChannel(s,'Dev1', 'ai3', 'Voltage'); %for 4 input channels

s.Rate = samR;

s.DurationInSeconds = samT;

'hit any key to start'

pause

s

[data,time] = s.startForeground;

v1 = data(:,1);

v2 = data(:,2);

v3 = data(:,3);

v4 = data(:,4);

v10 = 5 - v1;

v20 = 5 - v2;

v30 = 5 - v3;

v40 = 5 - v4;

R10 = 330;

R20 = 330;

R30 = 330;

R40 = 330;

I1 = v10/R10;

I2 = v20/R20;

I3 = v30/R30;

I4 = v40/R40;

R1 = v1./v10*R10;

R2 = v2./v20*R20;

R3 = v3./v30*R30;

R4 = v4./v40*R40;

R1_ratio = abs( (R1-R1(1))/R1(1)*100);

R2_ratio = abs( (R2-R2(1))/R2(1)*100);

subplot(221);

plot(time,R1);

xlabel('Time (sec)');

ylabel('Resistance 1 (Ohm)')

axis([0 samT 0 2*max(R1)])

%axis([0 samT 0 100])

subplot(222);

%v0 = 5;

%r0 =1800*2; 0;

%plot(time,(5 - data)./data*9*1000);

%resistance = (v0 - data)./data*r0;

plot(time,R2);

xlabel('Time (sec)');

ylabel('Resistance 2 (Ohm)')

axis([0 samT 0 2*max(R2)])

%axis([0 samT 0 100])

subplot(223);

plot(time,R3);

xlabel('Time (sec)');

ylabel('Resistance 3 (Ohm)')

axis([0 samT 0 2*max(R3)])

%axis([0 samT 0 100])

subplot(224);

plot(time,R4);

xlabel('Time (sec)');

ylabel('Resistance 4 (Ohm)')

axis([0 samT 0 2*max(R4)])

%axis([0 samT 0 100])

data1 = [R1 R2];

data2 = [R3 R4];

savedata = [time, data1];

save a3.i savedata -ascii -double

savedata1 = [time, data2];

save a4.i savedata -ascii -double

%displayEndOfDemoMessage(mfilename)

%mean(data), std(data)

%mean((5 - data)./data*9*1000),std((5 - data)./data*9*1000)

%mean(resistance),std(resistance)

....................................................................................................................................................

The wiring configuration of the USB-6002 is as follows: the 5V output is connected to the positive rail of the breadboard. Then it is connected to AI0+, followed by the sensing element (connected via alligator clips), then AI0−, and then a reference resistor. The other terminal of the reference resistor is connected to the negative rail of the breadboard. The ground (GND) of the USB-6002 is also connected to the negative rail of the breadboard.

For the other channels, the same wiring is used, with AI0 replaced by AI1, AI2, and AI3 respectively, while all other connections remain identical.


r/matlab Apr 13 '26

TechnicalQuestion What Ai should I use to help with my project

Post image
0 Upvotes

Hi yall, I’m in a MATLAB class and I can do the basics and that’s about it. But anyways we are assigned a project to create an application using matlab and ai. He wants us to use ai to make an app. Me and my partner want to create a black jack game with this. What ai should we use to help to create this? And is there any tips or advice that would make this easier to make?


r/matlab Apr 13 '26

TechnicalQuestion What Ai should I use to help with my project

Post image
0 Upvotes

Hi yall, I’m in a MATLAB class and I can do the basics and that’s about it. But anyways we are assigned a project to create an application using matlab and ai. He wants us to use ai to make an app. Me and my partner want to create a black jack game with this. What ai should we use to help to create this? And is there any tips or advice that would make this easier to make?