General - MATLAB Central Discussions
Sign in to participate

David
David
Last activity on 15 Jul 2024

Hello and a warm welcome to all! We're thrilled to have you visit our community. MATLAB Central is a place for learning, sharing, and connecting with others who share your passion for MATLAB and Simulink. To ensure you have the best experience, here are some tips to get you started:
  1. Read the Community Guidelines: Understanding our community standards is crucial. Please take a moment to familiarize yourself with them. Keep in mind that posts not adhering to these guidelines may be flagged by moderators or other community members.
  2. Ask Technical Questions at MATLAB Answers: If you have questions related to MathWorks products, head over to MATLAB Answers (new question form - Ask the community). It's the go-to spot for technical inquiries, with responses often provided within an hour, depending on the complexity of the question and volunteer availability. To increase your chances of a speedy reply, check out our tips on how to craft a good question (link to post on asking good questions).
  3. Choosing the Right Channel: We offer a variety of discussion channels tailored to different contexts. Select the one that best fits your post. If you're unsure, the General channel is always a safe bet. If you feel there's a need for a new channel, we encourage you to suggest it in the Ideas channel.
  4. Reporting Issues: If you encounter posts that violate our guidelines, please use the 🚩Flag/Report feature (found in the 3-dot menu) to bring them to our attention.
  5. Quality Control: We strive to maintain a high standard of discussion. Accounts that post spam or too much nonsense may be subject to moderation, which can include temporary suspensions or permanent bans.
  6. Share Your Ideas: Your feedback is invaluable. If you have suggestions on how we can improve the community or MathWorks products, the Ideas channel is the perfect place to voice your thoughts.
Enjoy yourself and have fun! We're committed to fostering a supportive and educational environment. Dive into discussions, share your expertise, and grow your knowledge. We're excited to see what you'll contribute to the community!
Mike Croucher
Mike Croucher
Last activity on 9 Jul 2025 at 17:39

In case you missed it in my overview of the MATLAB R2025a release, Markdown support has been greatly improved. This picture says it all
Mateusz
Mateusz
Last activity on 9 Jul 2025 at 16:08

The attached code is an animated solution of the three body problem. On 2024b it runs perfectly fine. When we tried it on 2025a, the animation constantly hitches, the CPU usage is almost double and the runtime is much slower. The curves also look less detailed and jagged in some places. When we run it without drawing anything, the performance seems comparable between versions, but still slightly slower. All of this behavior persists across different hardware. Anybody else having this kind of problem with the new release? I'm suspecting the graphics backend changes may be the culprit here...
clc
clear
close
syms t x1(t) y1(t) x2(t) y2(t) x3(t) y3(t)
G = 6.6743 * 10^-11;
%epsilon = 1e-4
m1 = 10^12;
m2 = 1*10^12;
m3 = 1*10^12;
r1 = [x1(t),y1(t)];
K1 = 1/2 * m1 * (diff(x1(t),t)^2 + diff(y1(t),t)^2);
r2 = [x2(t),y2(t)];
K2 = 1/2 * m2 * (diff(x2(t),t)^2 + diff(y2(t),t)^2);
r3 = [x3(t),y3(t)];
K3 = 1/2 * m3 * (diff(x3(t),t)^2 + diff(y3(t),t)^2);
L1x = diff(diff(K1,diff(x1(t),t)) , t);
L1y = diff(diff(K1,diff(y1(t),t)) , t);
L2x = diff(diff(K2,diff(x2(t),t)) , t);
L2y = diff(diff(K2,diff(y2(t),t)) , t);
L3x = diff(diff(K3,diff(x3(t),t)) , t);
L3y = diff(diff(K3,diff(y3(t),t)) , t);
r12 = r2 - r1;
r13 = r3 - r1;
r23 = r3 - r2;
dlugosc_r12 = sqrt(r12(1)^2 + r12(2)^2);
dlugosc_r13 = sqrt(r13(1)^2 + r13(2)^2);
dlugosc_r23 = sqrt(r23(1)^2 + r23(2)^2);
Q12 = G * m1 * m2 / dlugosc_r12^2 * (r2-r1)/dlugosc_r12;
Q13 = G * m1 * m3 / dlugosc_r13^2 * (r3-r1)/dlugosc_r13;
Q23 = G * m2 * m3 / dlugosc_r23^2 * (r3-r2)/dlugosc_r23;
Q21 = -Q12;
Q32 = -Q23;
Q31 = -Q13;
Q1 = Q12 + Q13;
Q2 = Q21 + Q23;
Q3 = Q31 + Q32;
eqn_1_x = L1x == Q1(1);
eqn_1_y = L1y == Q1(2);
eqn_2_x = L2x == Q2(1);
eqn_2_y = L2y == Q2(2);
eqn_3_x = L3x == Q3(1);
eqn_3_y = L3y == Q3(2);
syms X1 Y1 X2 Y2 X3 Y3
Q1_num = subs(Q1,[x1(t), y1(t), x2(t), y2(t), x3(t), y3(t)],[X1, Y1, X2, Y2, X3, Y3]);
Q2_num = subs(Q2,[x1(t), y1(t), x2(t), y2(t), x3(t), y3(t)],[X1, Y1, X2, Y2, X3, Y3]);
Q3_num = subs(Q3,[x1(t), y1(t), x2(t), y2(t), x3(t), y3(t)],[X1, Y1, X2, Y2, X3, Y3]);
syms vx1 vy1 vx2 vy2 vx3 vy3
state_dot = [
vx1;
vy1;
vx2;
vy2;
vx3;
vy3;
Q1_num(1)/m1;
Q1_num(2)/m1;
Q2_num(1)/m2;
Q2_num(2)/m2;
Q3_num(1)/m3;
Q3_num(2)/m3
];
f = matlabFunction(state_dot, 'Vars', {sym('t'), [X1; Y1; X2; Y2; X3; Y3; vx1; vy1; vx2; vy2; vx3; vy3]});
u0 = [-1e5; %x1
0; %y1
1e5; %x2
0; %y2
0; %x3
sqrt(3)*1e5; %y3
-11/2 * 1e-3; %vx1
11/2*sqrt(3)*1e-3; %vy1
-11/2 * 1e-3; %vx2
-11/2*sqrt(3)*1e-3; %vy2
11e-3; %vx3
0]; %vy3
tspan = [0, 1e9];
%options = odeset('RelTol', 1e-15, 'AbsTol', 1e-20);
[t_sol, u_sol] = ode45(f, tspan, u0);
t_anim = linspace(t_sol(1), t_sol(end), 5000);
u_anim = interp1(t_sol, u_sol, t_anim);
%%
% figure;
tor_1 = plot(u_anim(:,1), u_anim(:,2), 'r', 'LineWidth',1.5); hold on;
tor_2 = plot(u_anim(:,3), u_anim(:,4), 'g', 'LineWidth',1.5);
tor_3 = plot(u_anim(:,5), u_anim(:,6), 'b', 'LineWidth',1.5);
% xlabel('x [m]');
% ylabel('y [m]');
% legend('Ciało 1', 'Ciało 2', 'Ciało 3');
% title('Trajektorie ciał w układzie trzech ciał');
% axis equal
% grid on;
pozycja_1 = plot(u_anim(1,1),u_anim(1,2),'ro','markersize',10,'markerface','r'); hold on
pozycja_2 = plot(u_anim(1,3),u_anim(1,4),'go','markersize',10,'markerface','g');
pozycja_3 = plot(u_anim(1,5),u_anim(1,6),'bo','markersize',10,'markerface','b');
% xlim([-2e5,2e5])
% ylim([-2e5,2e5])
axis equal
for i = 1 : 1 : length(t_sol)
set(pozycja_1,'XData', u_anim(i,1),'YData', u_anim(i,2));
set(pozycja_2,'XData', u_anim(i,3),'YData', u_anim(i,4));
set(pozycja_3,'XData', u_anim(i,5),'YData', u_anim(i,6));
set(tor_1,'XData', u_anim(1:i,1),'YData', u_anim(1:i,2));
set(tor_2,'XData', u_anim(1:i,3),'YData', u_anim(1:i,4));
set(tor_3,'XData', u_anim(1:i,5),'YData', u_anim(1:i,6));
drawnow;
% pause(0.001);
end
Adam Danz
Adam Danz
Last activity on 7 Jul 2025 at 18:28

Are you a dark mode enthusiast or are you curious about how it’s shaping MATLAB graphics? Check out the latest article in the MATLAB Graphics and App Building blog.
🔹 User Insights: find out how user surveys influenced the development of graphics themes
🔹 Learn three ways to switch between light and dark themes for figures
🔹 Understand how custom and default colors behave across themes
🔹 Download a handy cheat sheet for working with themes in your graphics and apps.
Rik
Rik
Last activity on 7 Jul 2025 at 10:11

Similar to what has happened with the wishlist threads (#1 #2 #3 #4 #5), the "what frustrates you about MATLAB" thread has become very large. This makes navigation difficult and increases page load times.
So here is the follow-up page.
What should you post where?
Wishlist threads (#1 #2 #3 #4 #5): bugs and feature requests for Matlab Answers
Frustation threads (#1 #2): frustations about usage and capabilities of Matlab itself
Missing feature threads (#1 #2): features that you whish Matlab would have had
Next Gen threads (#1): features that would break compatibility with previous versions, but would be nice to have
@anyone posting a new thread when the last one gets too large (about 50 answers seems a reasonable limit per thread), please update this list in all last threads. (if you don't have editing privileges, just post a comment asking someone to do the edit)
I'm beginning this MATLAB-based numerical methods class, and as I was thinking back to my previous MATLAB/Simulink classes, I definitely remember some projects more fondly than others. One of my most memorable was where I had to use MATLAB to analyze electrocardiogram (ECG) peaks. What about you guys? What are some of the best (or worst 🤭) MATLAB projects or assignments you've been given in the past?
The new figure toolstrip in R2025a was designed from multiple feedback cycles with MATLAB users. See the latest article in the Graphics and App Building blog to see the evolution of the figure toolbar from 1996-2025, learn how user feedback shaped the new toolstrip, and check out the new code-generation feature that makes interactive data exporation reproducible.
Paul
Paul
Last activity on 30 Jun 2025 at 15:59

For the last day or two, I've been getting "upstream" and other various errors on Answers. Seems to come and go. Anyone else having similar issues?
cui,xingxing
cui,xingxing
Last activity on 30 Jun 2025 at 6:27

Mike Croucher
Mike Croucher
Last activity on 30 Jun 2025 at 6:06

In a discussion on LInkedin about my recent blog post, Do these 3 things to increase the reach of your open source MATLAB toolbox, I was asked by "Could you elaborate on why someone might consider opening/sharing their code? Thinking of early-career researchers, what might be in it for them?"
I'll give my answer here but I'm more interested in yours. How would you have answered this?
This is what I said:
  • It's the right thing to do scientifically. A computational paper is essentially just an advertisement of what you've done. The code contains vital details about how you actually did it. A computational paper is incomplete without the code.
  • If you only describe your algorithm in a paper, I have to implement it before I can apply your research to my problem. If you share the code, I can get started much more quickly using your research. This means I publish faster and since I am a good scientist, this means you get cited faster.
  • Other scientists start off as users of your code. This leads to citations. Over time, some of them start deeply using and modifying your code, this leads to collaborators.
  • Once you decide to share code via something like GitHub, you quickly start adopting good software engineering practices without initially realizing it. This improves the quality of your research since adopting good software practices makes it more likely that your software will give the right answers.
That last point can be a little hard to get your head around sometimes. Even if all you do is use file upload to get your stuff onto GitHub (i.e. you're not using git properly yet) you will start to naturally converge towards better code.
Why? Because as soon as you share code, you have to solve the problem of getting it to run on someone else's machine.
A trivial example concerns hard coded paths, for example. If you only ever run it on your machine then having a line like datafile = "C:\Mystuff\data.csv" always works but it breaks as soon as I try to run it on my machine. You'll look at this and think "Maybe there's a better way to do that".
Similarly dependencies. Your Path may be full of stuff that isn't present on my machine. As soon as I try to run your code, it won't work and you'll have to figure out how to handle dependencies in a reproducible way.
Documentation! An empty README.md is no good if you expect me to know how to use your code. You at least have to say something like "To run this, type runme(N) into MATLAB where N is the size of the model...etc etc)
The act of sharing, and dealing with the consequences, leads to much better code than if you keep it to yourself.
JH
JH
Last activity on 26 Jun 2025 at 15:40

As far as I can tell, there is still no official support for creating publication-ready tables from regression output, either as latex or natively. Although MATLAB isn't primarily statistical software, this still seems like an oversight, as almost any similar software has this capability built-in or as a package.
Adam Danz
Adam Danz
Last activity on 24 Jun 2025 at 13:37

The MATLAB R2025a release gave figures a makeover. @Brian Knolhoff, a developer on the Figure Infrastructure and Services team, reviews the new Figure Container in the Graphics and App Building blog.
Learn the four ways to tile figures, what docking means, and other new features.
Due to MATLAB being banned in some mainland Chinese universities in 2020, in recent years a Chinese company called "Suzhou Tongyuan SoftControl" has completely imitated MATLAB’s behavior. Below are some screenshots as evidence. What is your opinion on this issue?
Fayoz
Fayoz
Last activity on 9 Jun 2025

I bought standart licence no I cant get it
After waiting for a long time, the MathWorks official Community has finally resumed some of its functionalitys! Congratulations! Next, I’d like to share some thoughts to help prevent such outages from happening again, as they have affected far too many people.
  1. Almost all resources rely solely on MathWorks servers. Once a failure (or a ransomware attack) occurs, everything is paralyzed, and there isn’t even a temporary backup server? For a big company like MathWorks to have no contingency plan at all is eye-opening. This tells us that we should have our own temporary emergency servers!
  2. The impact should be minimized. For example, many users need to connect to the official servers to download various support packages, such as the Deep Learning Toolbox Converter for ONNX Model Format.” Could these be backed up and mirrored to the “releases” section of a GitHub repository, so users in need can download them.
  3. A large proportion of users who have already installed MATLAB cannot access the online help documentation. Since R2023a, installing the help documentation locally has become optional. This only increases the burden on the servers? Moreover, the official website only hosts documentation for the past five years. That means after 2028, if I haven’t installed the local offline documentation, I won’t be able to access the online documentation for R2023a anymore?
Anything else you’d like to add? Feel free to leave a comment.
The following lines were added to the subplot function in version 2025a (line 291):
if ancestorFigure.Units == "normalized"
waitfor(ancestorFigure,'FigureViewReady',true);
end
That code isn't in version 2024a.
Because of this, I'm experiencing issues that cause the code to stop running when using subplot in this way:
figure('Units','normalized','Position',[0 0 0.3 0.3])
subplot(1,2,1)
...
Has anyone else encountered this error?
Does anyone understand the need for those lines of code?
Aochen Xiao
Aochen Xiao
Last activity on 28 May 2025

It is April 3, 2025 now. Where is the MATLAB 2025a?
Any status updates on the license center and add on tool boxes?
Walter Roberson
Walter Roberson
Last activity on 17 May 2025

This topic is for discussing highlights to the current R2025a Pre-release.

About General

Discuss a wide range of MATLAB topics and share your thoughts and opinions with other community members.

This is the channel to post to if your topic doesn't fit any other channel contexts.
All technical questions
Community Guidelines MATLAB FAQs