r/matlab • • Feb 16 '16

Tips Submitting Homework questions? Read this

194 Upvotes

A lot of people ask for help with homework here. This is is fine and good. There are plenty of people here who are willing to help. That being said, a lot of people are asking questions poorly. First, I would like to direct you to the sidebar:

We are here to help, but won't do your homework

We mean it. We will push you in the right direction, help you find an error, etc- but we won't do it for you. Starting today, if you simply ask the homework question without offering any other context, your question will be removed.

You might be saying "I don't even know where to start!" and that's OK. You can still offer something. Maybe you have no clue how to start the program, but you can at least tell us the math you're trying to use. And you must ask a question other than "how to do it." Ask yourself "if I knew how to do 'what?' then I could do this." Then ask that 'what.'

As a follow up, if you post code (and this is very recommended), please do something to make it readable. Either do the code markup in Reddit (leading 4 spaces) or put it in pastebin and link us to there. If your code is completely unformatted, your post will be removed, with a message from a mod on why. Once you fix it, your post will be re-instated.

One final thing: if you are asking a homework question, it must be tagged as 'Homework Help' Granted, sometimes people mis-click or are confused. Mods will re-tag posts which are homework with the tag. However, if you are caught purposefully attempting to trick people with your tags (AKA- saying 'Code Share' or 'Technical Help') your post will be removed and after a warning, you will be banned.

As for the people offering help- if you see someone breaking these rules, the mods as two things from you.

  1. Don't answer their question

  2. Report it

Thank you


r/matlab • • May 07 '23

ModPost If you paste ChatGPT output into posts or comments, please say it's from ChatGPT.

109 Upvotes

Historically we find that posts requesting help tend to receive greater community support when the author has demonstrated some level of personal effort invested in solving the problem. This can be gleaned in a number of ways, including a review of the code you've included in the post. With the advent of ChatGPT this is more difficult because users can simply paste ChatGPT output that has failed them for whatever reason, into subreddit posts, looking for help debugging. If you do this please say so. If you really want to piss off community members, let them find out on their own they've been debugging ChatGPT output without knowing it. And then get banned.

edit: to clarify, it's ok to integrate ChatGPT stuff into posts and comments, just be transparent about it.


r/matlab • • 4h ago

Tips Am I reading into it too much?

Post image
14 Upvotes

I applied to an internship (EDG) at MathWorks like a little over a month ago (early September) and got intimidated by their coding assessment as I researched and found that they were really challenging, so I didn't even attempt them and decided to focus on my already busy school schedule and other internships I applied tor.
However this morning, I received an email from a recruiter encouraging me to do their online assessment, and since my last OA had expired ages ago, they even sent me a new link that expires later.

I of course don't want to read too much into it, and i'm already in an incredibly difficult semester full of classes right now with barely any free time, so I'd rather not invest my time towards this if it's not really a positive sign. I've already wasted my time doing so many OAs just to get rejected lol.
This is my first time applying for internship at MathWorks and i'm not quite sure if this a good sign or something standard that MathWorks does to candidates who sort of ghosted them and their
OAs

Any feedback/insights?


r/matlab • • 8h ago

Battery help

Post image
2 Upvotes

Hi guys. I'm doing HPPC characterization and i'd need help. Currently doing a 3RC model, and I only made it this far.

It doesn't work. All the starting values for my resistors and capacitors are 10 mOhm and 100 Farad. The OCV of the system is unknown but I actually did put a controlled voltage together with a controlled current. Maybe it's wrong.

In case you don't understand, I'm trying to do a parameter estimation using the opposite toolblxes.


r/matlab • • 10h ago

Space Vector PWM

0 Upvotes

r/matlab • • 1d ago

Space Vector PWM

2 Upvotes

Does anyone know how to run the simulation of Space vector PWM on two level inverter on MATLAB


r/matlab • • 2d ago

Cant Make New Script on MATLAB R2022a-Linux Mint Cinnamom

Post image
6 Upvotes

r/matlab • • 2d ago

Cant Make New Script on MATLAB R2022a-Linux Mint Cinnamon

Thumbnail
1 Upvotes

r/matlab • • 3d ago

Matlab for Android?

2 Upvotes

r/matlab • • 3d ago

HomeworkQuestion Making text displayed in a graph change based on the dataset being read by a function

0 Upvotes

Please be understanding as I just started learning Matlab for my engineering programming course so I'm very new to this. I'm trying to add text to a graph that is created from a function but I want the text to change what it says based on which dataset is being fed into the function. Its just a simple scatter plot taken from a set of x and y coordinates in a .txt file, but my homework wants us to display the mean and standard deviation of x and y.

So, if I'm using the dataset 'Fish_count_CO2' then it will put text on the graph that gives the mean and stdev of x and y for that dataset, but when I'm using 'Fish_count_N2' it will display the mean and stdev for that. Right now the script is just printing these values in the command window. I have pasted the script I created below for reference.

function filePlot(filename, graphTitle, xAxisLabel, yAxisLabel)

  raw_data=load(filename);
  x=raw_data(:,1);   % Assign the first column of data in raw_data to x, and the 2nd to y.
  y=raw_data(:,2);

  mean(x)  % For both x and y, display the mean and standard deviation.
  std(x)
  mean(y)
  std(y)

  scatter(x,y)  % Create a scatter plot of the fish counts vs. the gas concentration.
  xlabel(xAxisLabel)  % Add appropriate graph title and axis labels.
  ylabel(yAxisLabel)
  title(graphTitle)

endfunction

r/matlab • • 3d ago

HomeworkQuestion Help with setting x and y limits on a graph comparing 2 quadratics.

2 Upvotes

Hi, my college assignment is to make a program that plots 2 quadratic equations on the same graph to compare them. I’m struggling like hell to get the x and y limits to scale reasonably so that the graph is actually readable with both parabolas. Any pointers to where to start would be massively appreciated.

Edit: The user has to input a b and c, I can’t just pick any 2 that are easy to compare


r/matlab • • 5d ago

TechnicalQuestion Matlab best projects?

3 Upvotes

I am in my final year in ee and now i want to do some projects on matlab simulink..can someone help me out to basic to advance projects on matlab


r/matlab • • 6d ago

Maximum Stress Value

3 Upvotes

Yo, I recently got MATLAB and wanted to test some theory. I used a PDE method to perform an FEA analysis to compare it with my theory. I need your help ladies and gents, how does one visualise the maximum stress values, both principle and Von Moses if possible? Thank you.


r/matlab • • 6d ago

In dire need to unsterstand how a NOP function works (prefferably in MATLAB)

0 Upvotes

So, im a first time poster so pls be kind :) Also english isnt my first language so excuse any mistakes in my writing

Anyways, I just started my masters in computational mechanics, and I only had some basic knowledge on the subject from my postgrad (plus I only know C++, Matlab and theoretically fortran but not really). They just told us to write a code with a basic grid (like 3x3 or 3x4) and create a NOP(I,J) function, where I is the number of elements (square elements), J is the number of local nodes (J=1,...,4), and the output should be the global node corresponding to a specific local node of a specific element or something like that. Forgive me if the explanation is garbage, I understand it theoretically but not 'computationally' per say.

Does any kind human 1) have any idea of what i'm trying to say and 2) know how to actually help me? for some reason i cant find ANYTHING by googling, and no reddit posts as well (may have missed though). even AI cant help even though i prefer not to use it

Ty for reading xxx


r/matlab • • 8d ago

I recently joined MathWorks' Engineering Development Group (EDG) and am working on a project to improve Markdown support in MATLAB. AMA!

Post image
772 Upvotes

Hi everyone,

I'm Daniel, a MathWorker who joined the Engineering Development Group (EDG) this past June after graduating in May with a degree in Computer Science and Game Development.

Although it's only been a few months, I'm already working on exciting projects, including some work in the Markdown space for MATLAB. I'd love to hear your thoughts on Markdown and where/how you use it!

Since both my own application process and my first few months at the company are still fresh on my mind, I thought it might be helpful to do an AMA and answer questions about EDG, training and projects, or working at MathWorks in general.

I'm happy to answer whatever questions you all have, from the interview process, to the day-to-day, to my favorite color!

 

See the attached photo for verification, and as a disclaimer: while I do work for MathWorks, I am not an official spokesperson of the company, and everything I say here is my personal opinion.


r/matlab • • 7d ago

PID controller with two degrees of freedom

Thumbnail gallery
2 Upvotes

Those results can be easily obtain with simulink


r/matlab • • 7d ago

Tips Learning Matlab

20 Upvotes

I’m trying to learn Matlab. I come from exclusively Python programming. Any books/videos/youtubers you recommend for a beginner?


r/matlab • • 7d ago

Bug Command window not displaying results

Thumbnail
gallery
2 Upvotes

even after reinstalling matlab, trying out both 2026b and 2025b, this bug is persisting. It doesnt even show up when using ver command (pic 2). Can someone help?


r/matlab • • 8d ago

HomeworkQuestion I've been building a free MATLAB-compatible online compiler using GNU Octave, and I'd love some feedback.

3 Upvotes

Hey everyone!

I'm a computer engineering student, and MATLAB is something we use quite a lot at university, especially for signal processing, mathematical modeling, and other engineering subjects.

A while ago, I started working on a website with different online tools, and one of the things I wanted to add was a way to quickly run MATLAB-style code without having to install anything.

So I ended up building a browser-based compiler powered by GNU Octave, which is free and open source and supports a lot of MATLAB's syntax and functionality.

Here's the compiler if anyone wants to try it:

https://theonlinetoolset.com/tools/octave-compiler

The idea is to make it easy to experiment with things like:

  • Matrices and linear algebra – matrix operations, solving equations, and numerical calculations.
  • Mathematical functions – testing formulas and numerical methods.
  • Signal processing – experimenting with signals, FFTs, and related calculations where supported.
  • Plotting and visualization – working with graphs and mathematical results.
  • .m file support – working with MATLAB/Octave scripts and functions.
  • Engineering coursework – quickly testing small scripts and calculations.

One thing I seriously underestimated was how complicated it would be to run code submitted by users while keeping everything isolated and managing the server's resources.

It's definitely been an interesting challenge, and I'm still working on improving the experience.

Of course, since it's running GNU Octave rather than MATLAB itself, compatibility isn't perfect. Some MATLAB-specific functions and proprietary toolboxes won't work, and I'm not trying to pretend otherwise.

The goal isn't to replace MATLAB or a full desktop installation. I mainly wanted something convenient for students, teachers, or anyone who just needs to quickly experiment with a piece of code.

I'm actually curious about something:

For those of you who regularly work with MATLAB or Octave, what are the biggest compatibility issues you've encountered between the two?

Are there particular functions, toolboxes, or features you rely on that tend to be missing from Octave?

And if you give my compiler a try, I'd genuinely appreciate hearing about anything that doesn't work properly or could be improved.

I'm still developing the project alongside university, so feedback from people who use MATLAB professionally or academically would be incredibly helpful.


r/matlab • • 8d ago

Mathworks Minidrone competitions

Thumbnail in.mathworks.com
5 Upvotes

Does anyone knows MATLAB in depth . I need a teammate for this competition. If you wanna teamup DM me .


r/matlab • • 8d ago

Vehicle Body 3DOF and Longitudinal Wheel stuck at 0 speed (Algebraic Loop/Singularity)

1 Upvotes

I am building an EV digital twin in Simulink using the standard Longitudinal Wheel and Vehicle Body 3DOF Longitudinal blocks. I am not using the Simscape Driveline physical hub/axle blocks. The math signals are routed directly (Fx to FwF, and xdot back to Vx).

The Problem:

The vehicle speed (xdot) is stuck at exactly 0. The solver completes the run, but the vehicle refuses to move.

What I have proven so far:

  1. The powertrain works: The wheel block successfully outputs 6136 N of forward thrust (Fx).
  2. The chassis works: I bypassed the tire model completely and fed a Step block (8000 N) directly into the Vehicle Body's FwF port. The chassis accelerated perfectly on the scope.
  3. The zero-speed freeze strictly happens when I close the feedback loop (feeding vehicle speed xdot back into the tire's Vx input).

Attempted Fixes:

I suspect the Magic Formula tire model is hitting a divide-by-zero singularity at $t=0$, causing an algebraic loop. To fix this, I have already tried:

  • Setting the solver to ode15s.
  • Setting the Vehicle Body Initial velocity to 0.1 m/s.
  • Inserting a 1 / (0.01s + 1) Transfer Function on the Vx feedback line.
  • Adding a Saturation block (Lower limit 0.1) on the Vx feedback line.

Despite this, the vehicle remains locked at 0 speed. Does anyone know the specific trick to initialize this math loop so the vehicle can pull away from 0?


r/matlab • • 11d ago

CodeShare Discord Rich Presence for MATLAB and Simulink: shows what you're editing, running, debugging or simulating

26 Upvotes

Discord shows when you're gaming or listening to Spotify, but six hours of debugging a Simulink model shows up as nothing. I'm an electrical engineering student and live in MATLAB most of the week, so I wrote drpc, Discord Rich Presence for MATLAB.

What it shows

  • Editing pid_controller.m, with the line you're on and whether it's saved
  • Running a script, timed from when the run started
  • Debugging, paused at line 87
  • Simulating a Simulink model, with % done
  • App Designer, figures, the Command Window, and "Away" after 10 minutes idle

How it works

  • It runs entirely inside MATLAB. No Python or Node helper in the background.
  • A watchdog on a background thread notices when MATLAB is stuck in a long loop and switches you to "Running", so your status doesn't freeze.
  • MATLAB never waits on Discord. If Discord is closed or restarting, MATLAB doesn't notice, and drpc reconnects when it comes back.
  • The small C# bridge that talks to Discord is compiled on your PC from source, using the compiler that already ships with Windows. The repo contains no DLLs or EXEs.

Privacy: drpc names off hides file names, hidden_folders hides specific projects, and drpc pause hides everything for the session. It only talks to the Discord app on your own PC.

Install: paste this into the Command Window:

unzip("https://github.com/akeanti/matlab-discord-rpc/archive/refs/heads/main.zip", tempdir); run(fullfile(tempdir, "matlab-discord-rpc-main", "install.m"))

If you'd rather read the code first, download the latest release, look through it, and run install yourself.

Limits: Windows 10/11 only for now. You need the Discord desktop app and R2021a or newer. I've tested it on R2024a. On R2025a and later, telling the Editor apart from the Command Window relies on the old desktop, so that one detail may be off. If you're on 2025a+, I'd really like to know how it behaves.

macOS and Linux would need a different bridge (Discord uses a Unix socket there instead of a named pipe). It's doable, and PRs are welcome.

Repo: https://github.com/akeanti/matlab-discord-rpc

Free and MIT licensed. Not affiliated with MathWorks or Discord.

What part of MATLAB should it show that it doesn't yet?


r/matlab • • 11d ago

From SysId to Control | Experiment Design and Gotchas

Thumbnail
youtube.com
6 Upvotes

r/matlab • • 12d ago

ماتلاب

0 Upvotes

كيف احصل على تطبيق ماتلاب ف لابتوب الخاص بي


r/matlab • • 12d ago

Fun/Funny Yo guess who is using MATLAB for uni capstone

8 Upvotes