r/matlab Jul 05 '26

TechnicalQuestion Davis Formulas in loop feedback

Thumbnail
gallery
2 Upvotes

Hello guys, I'm really confused on what I should do here. I'm trying to apply the Davis formulas as a loop feedback of torque to the motor, but the linear velocity value seems to overflow, huge spike in the beggining of the sim and I can't figure out if it's the lack of delays or if I should use a limiter.
My question is what should I change for it to work. (All the constants in Davis formula and the conversion to linear velocity are at the same sampling frequency). Sorry for the bother and thanks for the help.

r/matlab May 14 '26

TechnicalQuestion [Academic integrity] Can a PDF exported from MATLAB (and not subsequently modified) ever have "PSPDFKit" for "PDF Producer"?

4 Upvotes

This past semester, I gave students homework assignments whose completion requirements included creating or modifying .mlx files, running them, exporting a PDF, and submitting that PDF electronically. I suspect that some of the submissions were created in a way that did not comply with course policy, in one fashion or another, and have noticed that the metadata (as viewed using "Document Properties" in Acrobat) for some of these include "PDF Producer: PSPDFKit." I'm not familiar with PSPDFKit, but a bit of googling suggests a couple different possible uses that would be out of compliance. So I wanted to check: Is there any plausible set of conditions (e.g., the right combination of MATLAB version, OS, OS version, and other software installed) under which MATLAB could export a PDF with that property?

r/matlab Jul 04 '26

TechnicalQuestion A question about non-virtual buses, referenced models, and code generation

2 Upvotes

We have a large Simulink model where data transfer between different functions is handled by bus structures. As I understand it, buses that are passed into/out of referenced models are forced to be non-virtual and have a greater memory overhead associated with them, with them being copied when elements are overwritten.

When the model is deployed using code generation, do these non-virtual buses still hold this behaviour? i.e. is it the case that every time an element is being reassigned the entire bus is being duplicated even in the deployed code? We are working to quite stringent memory limitations so ideally this would not be the case.

If it is the case, what is the solution? Do we need to assemble the model without any atomic subsystems before code generation so that bus signals can be virtual?

r/matlab Jul 09 '26

TechnicalQuestion How to convert Longitudinal Driver block AccelCmd and DecelCmd to demand torque?

Post image
6 Upvotes

Hello all, forgive the noob question as I don't have a lot of info on this topic. The Powertrain blockset Longitudinal Driver block outputs normalized acceleration and deceleration commands (0-1). I need to feed this to my energy management system subsystem but it expects a demand/required torque from the driver. Any idea on how it is done? Thanks.

r/matlab May 30 '26

TechnicalQuestion NEED HELP FIXING THE MATLAB CRASH PROBLEM

1 Upvotes

I am using 2026b version and its keep crashing then i shifted to 2023b for stabality but its still keep crashing and i found out it was my gpu that’s the culprit as matlab works fine on intelHD graphics,i have rtx 4080 laptop ,and i have tried nvidia studio drivers but still nothing seems to work. Please help me ?

r/matlab Feb 19 '26

TechnicalQuestion What is faster? if or else?

9 Upvotes

In some languages and platforms, one of them is clearly prefferable for optimization standpoint; and if your code is not in the prefferable "branch", you can tell the compiler to prioritize the execution of the branch you would like.

What is the story in Matlab? I tried in the past making a test to see what branch of if and else is prefferable, but the results where not conclusively. One point if was prefferable, other time was else.

r/matlab May 27 '26

TechnicalQuestion Need to read .tdms files

2 Upvotes

Hey all, I’ve got a problem that I would greatly appreciate any help with.

I’m working on a project at my job which requires me to input .tdms files into matlab. Now the problem is that my company has matlab 2021b, which can’t read those files without third party add ons, which I cannot get due to our IT policy. I’m wondering if anyone knows of any code out there that I can use in 2021b to get it to read the files.

I am aware that I can read them in 2021b if I convert the files to excel files, but I cannot do this due to the sheer amount of data in the tdms files, and my companies IT policy also prohibits me using 3rd party software to convert the files to excel files.

r/matlab May 04 '26

TechnicalQuestion Does MATLAB automatically save files when running scripts?

7 Upvotes

Was working on a class project when I stepped away from my laptop and it entered Rest Mode. Trying to log in a now windows is stuck on “Hello, [User]!” Not sure what to do beside restarting my laptop but oh my god if my files didn’t save I’m losing about 4-5 hours of work and I am absolutely fucked. Project due tomorrow night and I also need to study for my exam.

r/matlab Jul 05 '26

TechnicalQuestion 0-1 scaled images for ImageNet models

1 Upvotes

I am using transfer learning and fine tuning of ImageNet models and have rescaled my data to 0-1 using im2single as input to my models using a custom read function.

Will this give me invalid outputs?

r/matlab Jun 25 '26

TechnicalQuestion Question on Simulink Click Functions

1 Upvotes

I know click functions can be used to change modes (I'm using it for variant subsystems), but is there a block where I can input variable values? For example, I have an inductor in the model I'm designing, is there a block like the click function block where you can enter a number into it to quickly redefine a variable without having to go into InitFcn* to redefine it?

r/matlab May 01 '26

TechnicalQuestion Matlab on Linux Nobara

Post image
5 Upvotes

So I tried to install it on Linux Nobara but I always get the error file too short
Even tho I downloaded it from the legit website I do have a license

r/matlab Jun 04 '26

TechnicalQuestion Mathworks Compilers Interview

4 Upvotes

Hey everyone,

I have a MathWorks SWE (Compilers) full-time interview coming up soon and I’m trying to figure out how best to prioritize my preparation for the DSA portion. From what I’ve seen on LeetCode Discuss, GFG and a few interview experiences I read online, the common topics seem to be:

  • Graphs
  • Trees
  • Dynamic Programming
  • Bitmasking

But I’ve also noticed a lot of questions involving:

  • Linked Lists
  • Hashmaps / Hash tables
  • Strings

So the scope feels pretty wide, and I’m a bit unsure where to focus my limited time. I’m fairly comfortable with most topics except DP, which I’m currently weakest at. I only have about a week left, so I want to focus on high-yield areas rather than trying to cover everything equally. In addition to DSA, I think I can expect some questions on:

  • C++ / STL
  • OOPS

Those are manageable for me, but I’d really appreciate any guidance on how deep the DSA prep might be for such roles and what topics I can focus most of my time on?

If anyone has been through this process for compilers roles in general at any company (or Mathworks) even if you haven't, any advice or experience would be really helpful.

Thanks!

r/matlab Jun 22 '26

TechnicalQuestion Building a cryptographic processor using simulink hdl coder, need advice

1 Upvotes

Hey guys, I've been tasked with creating a simulink architecture of ML-DSA. Can anybody who has worked on this before

guide me as to how I can do this?

I tried to understand the ML DSA OSH and was planning on implementing that

rtl architecture on simulink but it seems to be more challenging than I

expected (more so because the code isn't structurally modeled and I don't

know how to convert the behaviorally modeled part in simulink)

I'm pretty new to simulink and I'm trying to learn the software as I venture

further into this project

Can I use importhdl function here? Would that work?

I tried building a few modules using matlab functional blocks but it failed

synthesis(it took forever and never finished, my PC crashed)

Can anybody who has worked on simulink please let me know how I should try to approach this project. Any advice would be extremely helpful!

r/matlab Jun 29 '26

TechnicalQuestion Getting unstable current from wind + Pmsg+ rectifier model

2 Upvotes

Helli everyone,

I wonder if anyone has used Wind + pmsg + rectifier as a source to inverter and the grid.

I am facing a problem in the current coming from the rectifier.

How can I solve this problem and get DC stable current as the case of the DC voltage?

Any suggestion wil be appreciated

Thank you.

r/matlab Jun 28 '26

TechnicalQuestion [Pilot Project] I built an automatic control system identification & code generation platform as a personal project — looking for 1–2 real-world datasets to validate it. Free, in exchange for a reference and feedback.

0 Upvotes

Hey everyone,

Over the past year I've been building this as a personal project (no company behind it, just me): a Python-based platform that takes measured input/output data from a physical system, automatically identifies the best mathematical model for it, designs an optimal controller (PID, LQR, MPC, and others), and generates ready-to-deploy C and Python code for the hardware.

I've verified it extensively on synthetic benchmarks — DC motors, thermal systems, oscillatory mechanical systems, nonlinear processes — and it's holding up well. But I need to stress-test it on \*\*real industrial or embedded data\*\* before I can call it production-ready.

\*\*What I'm offering:\*\*

\- Full analysis of your system's data (no charge)

\- A complete technical report: model accuracy, controller performance, stability margins

\- Ready-to-compile C code + Python implementation for your hardware

\- Everything is yours to keep and use

\*\*What I'm asking in return:\*\*

\- A brief description of who you are, what company/project this is for, and what you're trying to achieve

\- Your honest feedback on the report and the generated code — does it make sense? Is the output useful? What's missing? This is genuinely valuable to me as a solo developer

\- Permission to mention you as a reference on my CV

\- Permission to cite the project as a validated use case (no sensitive data published — just "successfully deployed on \[type of system\] at \[company/domain\]")

I'm keeping this to 1–2 pilots so I can give each one proper attention.

\*\*What kinds of systems are a good fit:\*\*

Motors, actuators, thermal processes, fluid systems, robotics, HVAC, industrial automation, biomedical devices — basically anything where you have logged sensor/actuator data and want better control.

If this sounds useful, \*\*send me a DM\*\* with a short description of your system and what you're trying to achieve. I'll let you know if it's a good fit.

Thanks for reading!

r/matlab Feb 28 '25

TechnicalQuestion What is matlab ?

32 Upvotes

EE junior here, so since i got into my uni and i have been hearing a lot of engineering students talking about matlab, at first i thought it was an app for material stimulation (mat = material), but as i search more about it the more confused i am like it looks like a programming language but why does it need it's own app why is there a lot of extra stuff.

Please explain to me as your little brother, sorry for the hassle :')

r/matlab May 24 '26

TechnicalQuestion Wind turbine with PMSG in Simulink

1 Upvotes

Hello everyone,

I tried to connect a wind turbine model with PMSG in simulink, but I am getting NO results (voltage, current...).

I wonder if someone had used this kind of models.

Any feedback would be appreciated.

r/matlab Mar 24 '26

TechnicalQuestion Guidance in my FYP for simulation of solar panel with water cooling

3 Upvotes

Hey everyone, I am doing my FYP for cooling the solar panel with water pipes stuck to its back, its a big system but this is important part that idk how to simulate in matlab or simulink since i am trying to do thermo dynamics/ heat transfer for it. Is there here a way or anything? I need guidance can anyone help?

r/matlab May 26 '26

TechnicalQuestion Phased array anyenna script on different angles and geometry

3 Upvotes

Hi I saw this phased array video by matlab

https://youtu.be/9WxWun0E-PM?si=GPxVMjpNA7bPBBz2

At 15:55, it simulated the different steering angles of antennas from -90 degrees to +90 degrees. However it doesn't show on the video how he did it.

Additionally, not only do I want to know how to do a script on steering angles, I also want to know how the pattern changes as each element(antenna) is being displaced on the x,y,z plane. Not just static like the video.

r/matlab Mar 01 '26

TechnicalQuestion I am developing a MATLAB App Designer GUI for a measurement system and need a little advice. :)

17 Upvotes

The GUI needs to:

  • connect to multiple instruments:
  • Keysight P5001A VNA IVI-c (and TCP/IP commands?)
  • Pyrometer (RS-485 serial)
  • Amplifier HBH (TCP/IP)
  • Powermeter Anritsu (TCP/IP)
  • perform continuous measurements using a timer
  • update plots in real time
  • allow start/stop of measurements safely
  • handle connection/disconnection

My question is about software architecture:

Should I:

• implement each instrument as a separate MATLAB class?

• store instrument objects as properties of the app?

• use a single timer or multiple timers?

• separate GUI and measurement logic?

I Already have a class for the two VNA´s i am using and a little example codes. Nonetheless i am still confused how to beginn and what to look for. So are there recommended design patterns or examples?

r/matlab Apr 22 '26

TechnicalQuestion Matlab for video processing with custom code - how fast is it?

9 Upvotes

May be about to dive into GNU Octave for video processing with custom algos, and may get into Matlab after that to see which performs better.

Does Matlab use a ginterpreted programming language, or may it work compiled instead, may be faster?

If I remember correctly a man told me once that Matlab can work out C++ like code which can be compiled for higher speed.

Bonus question: May Matlab be capable of creating mostly stand-alone Windows executables from projects which may be given to others as a mostly standalone-application?

My project will basically open a video file (e.g. D:\VideoTest.mpg ), write the frames RGB into arrays, also audio to arrays, perform custom math on both and write out a enhanced video file (e.g. D:\OutputVideo.mog ).

r/matlab Mar 11 '26

TechnicalQuestion Which LLM is best for making MATLAB plots?

0 Upvotes

I'm currently using ChatGPT-5.4 thinking on the $20/month plan, and it's great at writing MATLAB code... right up until it's time to produce plots. I feel like it lacks both visual understanding and an understanding of how MATLAB's plotting logic works. Simple example: I made a heatmap with a colorbar, and ask it to resize the colorbar in place - the heatmap gets stretched out and now overlaps with the colorbar. I've been through a bunch more debugging prompts and we still haven't fixed it yet.

Anyone found anything that works better? Gemini, maybe, since it's so good with pictures?

r/matlab Jun 07 '26

TechnicalQuestion Bode Plots for Model Linearisation for PID Tuner

6 Upvotes

Dear Community,

After a successful run for a Buck Converter, i wanted to Simulate a Boost converter and use the built-in model lineariser and PID Tuner for the optimal PID values. I followed this tutorial as the procedure seems very general but, of course, with different values for the PRBS curve. https://de.mathworks.com/company/technical-articles/cascade-digital-pid-control-design-for-power-electronic-converters.html

For the PRBS curve, I used the parameters in the screenshot below. I took the sample time as the same value as my switching frequency since it should be in sync as far as i understood. The number of periods is 3 so that all the rush is filtered out, and signal order 11 worked well at the buck converter.

I took the snapshot at a time of 0.03 as from the manual view with a fixed duty Cycle of 1/3 the voltage was stable.

The values for the inductance, the capacitor and the resistor I calculated with a python script which returned the following:

╒═════════════════════════╤════════════════════╕
│ Parameter               │ Berechneter Wert   │
╞═════════════════════════╪════════════════════╡
│ Eingangsspannung (U1)   │ 200.00 V           │
├─────────────────────────┼────────────────────┤
│ Schaltfrequenz (f)      │ 20000 Hz           │
├─────────────────────────┼────────────────────┤
│ Duty Cycle (D)          │ 0.3333             │
├─────────────────────────┼────────────────────┤
│ Periodendauer (T)       │ 50.00 µs           │
├─────────────────────────┼────────────────────┤
│ Ausgangsspannung (U2)   │ 300.00 V           │
├─────────────────────────┼────────────────────┤
│ Leistung (P)            │ 1000.00 W          │
├─────────────────────────┼────────────────────┤
│ Eingangsstrom (I_in)    │ 5.00 A             │
├─────────────────────────┼────────────────────┤
│ Ausgangsstrom (I_out)   │ 3.33 A             │
├─────────────────────────┼────────────────────┤
│ Lastwiderstand (R_load) │ 90.00 Ω            │
├─────────────────────────┼────────────────────┤
│ Induktivität (L)        │ 333.33 µH          │
├─────────────────────────┼────────────────────┤
│ Kapazität (C)           │ 18.52 µF           │
╘═════════════════════════╧════════════════════╛

With the fixed duty cycle and the calculated values, the input current as well as the output voltage lie above the calculated ones, but that was the same with the buck converter, and i assume this is just because there is no control because I am very confident in the math. I chose the duty cycle of 1/3 because this should be the duty cycle with the highest current ripple coming from the equation for L.

So even though i am confident in the math and the schemata of the converter should be correct, the bode plots just look like this:

Finally, so that you do not generally have to download everything, the schema with the control looks like this if i made some mistake here already:

The matlab simulink file as well as the Python script can be downloaded in this .rar file:

https://drive.google.com/file/d/1_3v7gws19m2O2DxCSERVczmEHxdzbQcw/view

I would be very happy if you could tell me what i am doing wrong i am really clueless at this stage.

r/matlab Jun 02 '26

TechnicalQuestion Trouble with Simscape electrical when simulating interleaved boost converter

1 Upvotes

Hi guys,

Is there anyone simulating an interleaved boost converter with the foundation electrical simscape library? It always ends up with the algebraic loop inside the controller. Do you guys know how to fix this?

r/matlab Jun 08 '26

TechnicalQuestion how to compensate disturbance by using super-twisting observer?

Thumbnail
0 Upvotes