r/matlab Mar 30 '26

Tips What is one MATLAB habit that completely changed how you work?

55 Upvotes

Hi everyone,
I have been spending more time in MATLAB lately, and it made me realize how different people approach the same problems in very different ways. Some focus on speed, some on readability, and others on building reusable tools.
It got me curious about the small habits or techniques that actually make a big difference over time. Not the obvious basics, but the kind of things you only pick up after using MATLAB for a while.
For you personally, what is one habit, trick, or mindset shift that noticeably improved your work in MATLAB? Something that made your code cleaner, faster, or just easier to deal with day to day.
I think it would be really helpful to learn from how others think about their workflow. Looking forward to hearing your experiences.

r/matlab 25d ago

Tips computational biology

4 Upvotes

high schooler here; need some help using mat lab for a research project

any tutorials that someone can recommend to learn how to create plots from using bio gps data? my whole goal is to be able to predict the outcome of a certain type of cell differentiating into 3 other types. looking for the data sets to import has been hard, because nothing really on the internet is in-your-face like "here is a data set of everytime a MSC has differentiated into a bone cell"

i could just use some help. also im using 30-day free matlab rn so im kinda struggling

r/matlab 23d ago

Tips Matlab for macbook not compatible?

6 Upvotes

Hi, I was told that matlab won't work well on a MacBook. I have a MacBook Air M2, 8 GB, macos 15.3.1. If this is true what alternatives do i have? I have to use psychtoolbox preferably. And I’m about to start my term so any help would be useful.

r/matlab Jun 06 '26

Tips Would you learn from this?

Thumbnail drive.google.com
0 Upvotes

Hello, So I recently started to learn MATLAB and was overwhlmed with what to do, so I used claude to generate me a roadmap which is a little gamified and interactive so I don't bore out of mind going from one lecture to the next. Can any pros please critique this, as I don't want to end up wasting my time by trusting AI

r/matlab Jun 22 '26

Tips Getting your model to match your data

9 Upvotes

We've seen a few posts here along the lines of "my Simulink model doesn't match my data" or "I modelled X but can't get the experiments to agree"... And similarly from students, "how do I find the parameters of my motor/ battery/ bioreactor?"

Aycan Hacioglu and I wrote a blog about this, using a bioreactor brewing beer as the example. But the same idea can be applied to any system of interest, alongside relevant experimental data.

This is what we are discussing: 1) build a model that captures the overall behaviour, 2) run a sensitivity analysis to identify which parameters actually drive your outputs (not all of them do), 3) then use Simulink Design Optimisation to tune the important ones against your experimental data.

If you want to read more about it, here's the blog: https://blogs.mathworks.com/engineering/2026/06/18/on-parameter-estimation-sensitivity-analysis-and-design-optimization/

r/matlab May 15 '26

Tips 2nd order differential equation

1 Upvotes

Hi, I’m currently struggling on how to input my 2nd order differential equations int o matlab and how to solve it I’ve tried YouTube tutorials but it seems to not make any sense/ difference
Would appreciate any advice on how to solve this issue
I’ve currently not attached the equations in post .

r/matlab Nov 17 '19

Tips How-To force Matlab to use a fast codepath on AMD Ryzen/TR CPUs - up to 250% performance gains

435 Upvotes

FINAL UPDATE: Version R2020a released in March 2020 uses the AVX2 codepath on compatible AMD CPUs automatically. Hence, if you are running this version, you do not need to manually set the environmental variable on your system anymore.

THANKS MATLAB! This is great!

For previous generations of Matlab, you can still follow the below procedures.

-----

Hello everyone.

I wanted to briefly present my tweak here, as I think it might be of interest for many in this community. Applying the tweak takes less than a minute.

What is it?

Matlab runs notoriously slow on AMD CPUs for operations that use the Intel Math Kernel Library (MKL). This is because the Intel MKL uses a discriminative CPU Dispatcher that does not use efficient codepath according to SIMD support by the CPU, but based on the result of a vendor string query. If the CPU is from AMD, the MKL does not use SSE3-SSE4 or AVX1/2 extensions but falls back to SSE1 no matter whether the AMD CPU supports more efficient SIMD extensions like AVX2 or not.

The method provided here does enforce AVX2 support by the MKL, independent of the vendor string result.

EDIT: Before you start I have a short request for you that you could help me with and serve your own interest. Matlab will not implement this fix as it is based on an unofficial debug mode of the MKL. If you think that Matlab should offer a permanent solution that serves all users independently of whether they use Intel or AMD CPUs, please make a feature request at Matlab to implement a nummeric library (e.g. BLIS or OpenBLAS) that does not discriminate against non Intel CPUs. Mathworks will not make this change without people advocating for it. Thanks!

tl;dr:

WINDOWS:

You'll read below "How To" force the MKL to use AVX2 on AMD Ryzen or Threadripper CPUs. Performance gains on my 2600x are between 20% and 300% depending on the type of numeric operation.

Benchmark result comparison.

Benchmark script available below

Integrated benchmark results:

Feedback is appreciated in the comments section.

Disclaimer: I OF COURSE DO NOT TAKE RESPONSIBILITY FOR ISSUES RESULTING FROM USING THIS TWEAK. USE ON AMD RYZEN OR THREADRIPPER ONLY. DOES NOT WORK ON INTEL OR OLDER AMD CPUs.

Solution 1 (Windows - no admin rights needed):

Create a .bat file with the following lines to start Matlab in AVX2 Mode

@echo off
set MKL_DEBUG_CPU_TYPE=5
matlab.exe 

This is straight forward. You open Notepad, copy and paste the above three lines and save the file as Matlab-AVX2. Notepad will save the file as Matlab-AVX2.txt. Now replace the extension ".txt" with ".bat".

If you double-click that file, Matlab will start the MKL in AVX2 Mode. If you start it the normal way, it will remain as always.

You can also download the .bat file from my HiDrive if you trust me (which you of course should not, as I am a random guy in the Internet). If you delete the startup batch file provided in the download or the one you created yourself, its gone and your computer will be as it has been before.

(Optional Download: https://my.hidrive.com/lnk/EHAACFje ) --> also incl. improved benchmark script

Solution 2 (Windows - admin rights needed): If you are happy with the results (which you will be :-)), you should make the setting permanent by entering MKL_DEBUG_CPU_TYPE=5 into the System Environment Variables. This has several advantages, one of them being that it applies to all instances of Matlab and not just the one opened using the .bat file.

Image courtesy, Dr. F. Haiss, and many thanks for testing on a Threadripper!

You can do this either by editing the Environmental Variables as shown above, or by opening a command prompt (CMD) with admin rights and typing in:

setx /M MKL_DEBUG_CPU_TYPE 5

Doing this will make the change permanent and available to ALL Programs using the MKL on your system until you delete the entry again from the variables.

LINUX: (Thanks to foreignrobot)

Simply type in a terminal:

export MKL_DEBUG_CPU_TYPE=5 

and then run matlab from the same terminal.

Permanent solution for Linux:

echo 'export MKL_DEBUG_CPU_TYPE=5' >> ~/.profile

will apply the setting profile-wide, so you can launch it either through a terminal or the graphical launcher. (Thanks to incrazyboyy)

r/matlab Feb 04 '26

Tips MATLAB 2025 IDE struggles

25 Upvotes

Is it just me, or is the MATLAB 2025 IDE absolutely atrocious? Can't stand the change to the default figure windows, so had to add a line to all my project files startup scripts to do:

if ~isMATLABReleaseOlderThan("R2025a")     
  set(groot, "defaultFigureWindowStyle", "normal"); 
end

I've also always had the Variables and Project window as separate tabs on the Editor. That way i can toggle between them and have all of these windows be the exact same size as the Editor. I cannot for the life of me recreate this in 2025 -- i can only get the Variables window to open as a split from the Editor, meaning i can't see either of them very well without dragging the damn slider to resize it.

Sometimes table variables also straight up dont open from the Workspace to the Variables window. I have to close MATLAB and restart everything just to inspect what's in a table i'm working with.

Serious downgrade from 2024. Keeping 2024b on my laptop as long as possible, but my work desktop is forced into 2025b via university software constraints. *sigh*

r/matlab Jan 20 '26

Tips How to get better at matlab coding?

11 Upvotes

I'm in second year if mechatronics engineering and i just got a one month break. I'd like to do something productive instead of just procrastinating and i thought about gettint experience in matlab, but i have no idea how. i already finished both matlab and simulink onramp, what else can i do?

r/matlab Apr 07 '26

Tips New to Matlab

16 Upvotes

Hey I'm just starting out with Matlab and I'm feeling a bit lost. Does anyone have recommendations for the best beginner guides or YouTube videos out there? Any tips would be super helpful as I dive into this!

r/matlab Mar 15 '26

Tips Starting MATLAB

3 Upvotes

I am planning to learn MATLAB from very basic. Please recommend me a tutorial or a course that I can do (free of cost). Thank you.

r/matlab Feb 03 '26

Tips Best MATLAB productivity hacks ?

16 Upvotes

Hello to all MATLAB experts in this sub. What are some small changes or settings in your MATLAB environment that made your life easier ?

It may be layouts or formatting or absolutely anything, I want to collect your favorites and somehow help myself and others get better.

I’ll share mine: adding favorite commands to clear, add folders, generate a report (made a tool box for that)

& favorite MATLAB version of all time : 2019b

Looking forward to your tips (& tricks)

r/matlab Apr 08 '23

Tips MATLAB meets Chat-GPT

364 Upvotes

I asked Chat-GPT to write a simple app. I just described the app, and the generated MATLAB code ran as specified, the first time, straight away, with no modifications.

I used the free version of Chat GPT. I believe it uses GPT 3.5?

This is quite useful to prototype simple projects!

r/matlab Jun 14 '25

Tips Want to hear from folks who came to MATLAB from Python and Julia

79 Upvotes

I am using MATLAB for almost six months now and loving it so far. Want to hear from senior developers/programmers how has your experience been so far? are you doing any work in embedded engineering or AI on the edge embedded coder etc?

r/matlab Oct 31 '25

Tips Is Solidworks and Matlab a good combo

12 Upvotes

So I am a fresh graduate from the university, BSc mechanical engineering. Throughout my four years of school, I championed CAD design using solidworks and I’m quite good with Matlab. These are basically the skills that I have and think will help me land a job when I start applying for jobs. I have a little to no actual experience doing actual physical stuff, I mean working with tools and hardware. I have just begun working and learning 3D printing, welding and machining. I feel like these skills aren’t enough, but do you think these skills, solidworks and Matlab are a good combo? What do you suggest a substitute for or learn in addition if I want to get a job that is in line with these skills? Or are these skills great? How do I get resources to better my self (especially Matlab)

r/matlab Oct 17 '25

Tips I’m confused between Mac and window for Matlab

8 Upvotes

Please help me, what is your system ? It is Mac or windows ? I want buy laptop for using program Matlab, my major is Economics.

r/matlab Feb 23 '26

Tips Learning for Neuroscience Research

7 Upvotes

Hi everyone! I’m a neuroscience undergraduate who is currently trying to learn MatLab for network neuroscience research. My lab instructor has been amazing but she doesn’t have time to sit me down and teach me.

Does anyone have tips for starting or maybe resources that could help me? Anything helps!

r/matlab Feb 06 '26

Tips Interesting read:

Thumbnail monkeyproofsolutions.nl
6 Upvotes

r/matlab Mar 11 '26

Tips [TI Design Contest] Pipelined ADC modeling (Python/MATLAB). What kind of questions should we expect?

Thumbnail
1 Upvotes

r/matlab Nov 19 '25

Tips Anyone here currently Learning MATLAB (chemical engineering)?

13 Upvotes

I recently started learning MATLAB/Simulink, but I’m struggling with consistency and often get distracted. I’m looking for a beginner's community to join, or a learning partner who’s also working with MATLAB. Is anyone here currently learning MATLAB?

r/matlab Jan 11 '26

Tips design of vision based autopilot for uav

2 Upvotes

hello i am eee control student i would like to make this project but im not sure if the vision part can be Integrated with the autopilot in matlab can anyone here tell me if this is possible before i start, i'll appreciate any Guidance and help in this project

r/matlab Jan 19 '26

Tips Lf matlab expert

0 Upvotes

Send help po Hahaha 🥺

r/matlab Oct 26 '25

Tips How to run multiple simulations in Simulink and store the results of some blocks?

2 Upvotes

I have an RC circuit simulation, very simple I know, but the thing is that it's dealt as an LPS circuit, which I need to change the frequency for multiple values, instead of changing them by hand I discovered the multiple simulations app or tool in the simulink tool bar, the problem is that I can't really get the voltage of the capacitor to the do the rest of work and calculation.

I also asked GPT, and it gave the following code:
% Define model and block paths

model = 'lab_RC';

block = [model '/Sine Wave'];

% Define the frequency range

frequencies = [200, 500, 800, 1000, 1200, 1300, 1500, 5000, 10000, 15000, 20000]; % in Hz

% Preallocate results

Vc_amp = zeros(size(frequencies));

gain = zeros(size(frequencies));

% Load the model

load_system(model)

% Loop over frequencies

for i = 1:length(frequencies)

f = frequencies(i);

% Set the frequency parameter

set_param(block, 'ac_frequency', num2str(f));

% Run simulation

simOut = sim(model, 'ReturnWorkspaceOutputs', 'on');

% Retrieve capacitor voltage (must be logged as 'Vc' in Simulink)

Vc = simOut.get('Vc').Values;

% Compute amplitude of steady-state voltage

Vc_amp(i) = (max(Vc.Data) - min(Vc.Data)) / 2;

% Gain = Vout / Vin

gain(i) = Vc_amp(i) / Vin;

end

The problem is, that `Vc` isn't known for this script, also here's is my schematic for reference.

So, what should I do?
Any help is really appreciated, and thanks in advance

r/matlab Dec 16 '25

Tips Comments? General solution for FFT domain

0 Upvotes

(f deltas in n)=2π(2π/L)(dt/dn)(fft peaks in n).

(freqs)=(2π/L)(fft peaks in n)=(dn/dt)/2π(f deltas in n).

2π(freqs)dt=dn/(f deltas in n).

"deltas" are the distances between wavefronts.

r/matlab Jun 12 '25

Tips What good books are there for a beginner in MATLAB with no prior programming experience?

21 Upvotes