Main Content

Results for


I'm getting this annoying survey (screenshot below) in the help windows of MATLAB R2024b this morning. It blocks the text I'm actually trying to read, when minimised it pops up again after a few minutes, and persists even after picking an option and completing the SurveyMonkey survey it links to. I don't even know what the OPC UA server so rest assured any of my answers to that survey aren't going to help MathWorks improve their product.
Aochen Xiao
Aochen Xiao
Last activity about 21 hours ago

It is April 3, 2025 now. Where is the MATLAB 2025a?
Giuseppe
Giuseppe
Last activity on 2 Apr 2025 at 19:10

ho questo codice matlab, vorrei creare un grafico inerente all'andamento di c1,c2,cm al variare di d1, purtroppo mi da sempre lo stesso errore horzcat, inerente alle dimensioni delle matrici , nonostante le dimensioni siano corrette e uguali
Me: If you have parallel code and you apply this trick that only requires changing one line then it might go faster.
Reddit user: I did and it made my code 3x faster
Not bad for just one line of code!
Which makes me wonder. Could it make your MATLAB program go faster too? If you have some MATLAB code that makes use of parallel constructs like parfor or parfeval then start up your parallel pool like this
parpool("Threads")
before running your program.
The worst that will happen is you get an error message and you'll send us a bug report....or maybe it doesn't speed up much at all....
....or maybe you'll be like the Reddit user and get 3x speed-up for 10 seconds work. It must be worth a try...after all, you're using parallel computing to make your code faster right? May as well go all the way.
In an artificial benchmark I tried, I got 10x speedup! More details in my recent blog post: Parallel computing in MATLAB: Have you tried ThreadPools yet? » The MATLAB Blog - MATLAB & Simulink
Give it a try and let me know how you get on.
Chalachew
Chalachew
Last activity on 31 Mar 2025 at 12:41

I hope you well receive this messege as well.
I am happy jion for your site.
I start to do project on UAV
kindy could you please send me you tube, documets regarding to quadrotror mathlab simulink?
Please help me
看到知乎有用Origin软件绘制3D瀑布图,觉得挺美观的,突然也想用MATLAB复现一样的图,借助ChatGPT,很容易写出代码,相对Origin软件,无需手动干预调整图像属性,代码控制性强:
%% 清理环境
close all; clear; clc;
%% 模拟时间序列
t = linspace(0,12,200); % 时间从 0 到 12,分 200 个点
% 下面构造一些模拟的"峰状"数据,用于演示
% 你可以根据需要替换成自己的真实数据
rng(0); % 固定随机种子,方便复现
baseIntensity = -20; % 强度基线(z 轴的最低值)
numSamples = 5; % 样本数量
yOffsets = linspace(20,140,numSamples); % 不同样本在 y 轴上的偏移
colors = [ ...
0.8 0.2 0.2; % 红
0.2 0.8 0.2; % 绿
0.2 0.2 0.8; % 蓝
0.9 0.7 0.2; % 金黄
0.6 0.4 0.7]; % 紫
% 构造一些带多个峰的模拟数据
dataMatrix = zeros(numSamples, length(t));
for i = 1:numSamples
% 随机峰参数
peakPositions = randperm(length(t),3); % 三个峰位置
intensities = zeros(size(t));
for pk = 1:3
center = peakPositions(pk);
width = 10 + 10*rand; % 峰宽
height = 100 + 50*rand; % 峰高
% 高斯峰
intensities = intensities + height*exp(-((1:length(t))-center).^2/(2*width^2));
end
% 再加一些小随机扰动
intensities = intensities + 10*randn(size(t));
dataMatrix(i,:) = intensities;
end
%% 开始绘图
figure('Color','w','Position',[100 100 800 600],'Theme','light');
hold on; box on; grid on;
for i = 1:numSamples
% 构造 fill3 的多边形顶点
xPatch = [t, fliplr(t)];
yPatch = [yOffsets(i)*ones(size(t)), fliplr(yOffsets(i)*ones(size(t)))];
zPatch = [dataMatrix(i,:), baseIntensity*ones(size(t))];
% 使用 fill3 填充面积
hFill = fill3(xPatch, yPatch, zPatch, colors(i,:));
set(hFill,'FaceAlpha',0.8,'EdgeColor','none'); % 调整透明度、去除边框
% 在每条曲线尾部标注 Sample i
text(t(end)+0.3, yOffsets(i), dataMatrix(i,end), ...
['Sample ' num2str(i)], 'FontSize',10, ...
'HorizontalAlignment','left','VerticalAlignment','middle');
end
%% 坐标轴与视角设置
xlim([0 12]);
ylim([0 160]);
zlim([-20 350]);
xlabel('Time (sec)','FontWeight','bold');
ylabel('Frequency (Hz)','FontWeight','bold');
zlabel('Intensity','FontWeight','bold');
% 设置刻度(根据需要微调)
set(gca,'XTick',0:2:12, ...
'YTick',0:40:160, ...
'ZTick',-20:40:200);
% 设置视角(az = 水平旋转,el = 垂直旋转)
view([211 21]);
% 让三维坐标轴在后方
set(gca,'Projection','perspective');
% 如果想去掉默认的坐标轴线,也可以尝试
% set(gca,'BoxStyle','full','LineWidth',1.2);
%% 可选:在后方添加一个浅色网格平面 (示例)
% 这个与题图右上方的网格类似
[Xplane,Yplane] = meshgrid([0 12],[0 160]);
Zplane = baseIntensity*ones(size(Xplane)); % 在 Z = -20 处画一个竖直面的框
surf(Xplane, Yplane, Zplane, ...
'FaceColor',[0.95 0.95 0.9], ...
'EdgeColor','k','FaceAlpha',0.3);
%% 进一步美化(可根据需求调整)
title('3D Stacked Plot Example','FontSize',12);
constantplane("x",12,FaceColor=rand(1,3),FaceAlpha=0.5);
constantplane("y",0,FaceColor=rand(1,3),FaceAlpha=0.5);
constantplane("z",-19,FaceColor=rand(1,3),FaceAlpha=0.5);
hold off;
Have fun! Enjoy yourself!
Hello Community,
We're excited to announce that registration is now open for the MathWorks AUTOMOTIVE CONFERENCE 2025! This event presents a fantastic opportunity to connect with MathWorks and industry experts while exploring the latest trends in the automotive sector.
Event Details:
  • Date: April 29, 2025
  • Location: St. John’s Resort, Plymouth, MI
Featured Topics:
  • Virtual Development
  • Electrification
  • Software Development
  • AI in Engineering
Whether you're a professional in the automotive industry or simply interested in these cutting-edge topics, we highly encourage you to register for this conference.
We look forward to seeing you there!
We are excited to announce another update to our Discussions area: the new Contribution Widget! The new widget simplifies the process of creating diverse types of content, whether you're praising someone who has helped you, sharing tips and tricks, or polling the community.
Previously, creating various types of content required navigating multiple links or channels. With the new Contribution Widget, everything you need is conveniently located in one place.
Give it a try and let us know how we can further enhance your user experience.
P.S. Who has been particularly helpful to you lately? Create your first praise post and let them know!
David
David
Last activity on 29 Mar 2025 at 2:44

We are excited to announce the first edition of the MathWorks AI Challenge. You’re invited to submit innovative solutions to challenges in the field of artificial intelligence. Choose a project from our curated list and submit your solution for a chance to win up to $1,000 (USD). Showcase your creativity and contribute to the advancement of AI technology.
I am pleased to announce the 6th Edition of my book MATLAB Recipes for Earth Sciences with Springer Nature
also in the MathWorks Book Program
It is now almost exactly 20 years since I signed the contract with Springer for the first edition of the book. Since then, the book has grown from 237 to 576 pages, with many new chapters added. I would like to thank my colleagues Norbert Marwan and Robin Gebbers, who have each contributed two sections to Chapters 5, 7 and 9.
And of course, my thanks go to the excellent team at the MathWorks Book Program and the numerous other MathWorks experts who have helped and advised me during the last 30+ years working with MATLAB. And of course, thank you Springer for 20 years of support.
This book introduces methods of data analysis in the earth sciences using MATLAB, such as basic statistics for univariate, bivariate, and multivariate data sets, time series analysis, signal processing, spatial and directional data analysis, and image analysis.
Martin H. Trauth
I am trying to integrate an external C++ function (large package) into a mex function. I have written a cmake file, which generates library for external C++ function and I am using matlab_add_mex to generate the mex-file.
# Find MATLAB
set(Matlab_ROOT_DIR "../mathworks/2023b/bin/")
find_package(Matlab REQUIRED)
# Add a MEX target
matlab_add_mex(
NAME my_mex_function
SRC my_mex_function.cpp
LINK_TO my_library
)
find_package(Matlab REQUIRED) - gives following error:
CMake Error at CMakeLists.txt: (find_package):
By not providing "Findmatlab.cmake" in CMAKE_MODULE_PATH this project has asked CMake to find a package configuration file provided by "matlab", but CMake did not find one.
Could not find a package configuration file provided by "matlab" with any of the following names:
matlabConfig.cmake
matlab-config.cmake
Add the installation prefix of "matlab" to CMAKE_PREFIX_PATH or set "matlab_DIR" to a directory containing one of the above files. If "matlab" provides a separate development package or SDK, be sure it has been installed.
I searched for matlabConfig.cmake or matlab-config.cmake in matlab installation directory but did not find it. Does Matlab provide provide such files or not? If not how to integrate large C++ programs with MATLAB. I dont want to use system function calls as they are too slow.
Mike Croucher
Mike Croucher
Last activity on 25 Mar 2025 at 11:51

There has been a lot of discussion here about the R2025a Prerelease that has really helped us get it ready for the prime time. Thank you for that!
A new update of the Prerelease has just dropped. So fresh it is still warm from the oven! In my latest blog post I discuss changes in the way MathWorks has been asking-for and processing feedback...and you have all been a part of that.
If you haven't tried the Prerelease in a while, I suggest you update and see how things are looking now.
If you have already submitted a bug report and it hasn't been fixed in this update, you don't need to submit another one. Everything is being tracked!
Have a play, discuss it here and thanks for again for being part of the process.
Bonsoir,
Je suis en train de finaliser Module 4 du cours "Designing and Simulating Physical Models" et j’ai quelques difficultés avec les derniers quiz, notamment ceux liés au projet Simulating Motor Heat Effects.
J’ai suivi toutes les étapes du projet et compris l’utilisation des blocs Relay, PS Product et Thermal Mass, mais j’aimerais avoir des clarifications sur :
Comment tester efficacement mon modèle pour vérifier que la logique de coupure fonctionne bien ?
Quels paramètres thermiques sont les plus critiques pour éviter les erreurs de simulation ?
Y a-t-il des erreurs fréquentes à éviter dans les quiz finaux ?
Si quelqu’un a réussi ces quiz et peut me donner quelques conseils ou orientations, ce serait super !
Merci beaucoup pour votre aide.
Joseff Bailey-Wood
Joseff Bailey-Wood
Last activity on 3 Apr 2025 at 16:05

Hi! I'm Joseff and along with being a student in chemical engineering, one of my great passions is language-learning. I learnt something really cool recently about Catalan (a romance language closely related to Valencian that's spoken in Andorra, Catalonia, and parts of Spain) — and that is how speakers tell the time.
While most European languages stick to the standard minutes-past / minutes-to between hours, Catalan does something really quite special, with a focus on the quarters (quarts [ˈkwarts]). To see what I mean, take a look at this clock made by Penguin___Lover on Instructables :
If you want to tell the time in Catalan, you should refer to the following hour (the one that's still to come), and how many minutes have passed or will pass for the closest quarter (sometimes half-quarter / mig quart [ˈmit͡ʃ kwart]) — clear as mud? It's definitely one of the more difficult things to wrap your head around as a learner. But fear not, with the power of MATLAB, we'll understand in no time!
To make a tool to tell the time in Catalan, the first thing we need to do is extract the current time into its individual hours, minutes and seconds*
function catalanTime = quinahora()
% Get the current time
[hours, minutes, seconds] = hms(datetime("now"));
% Adjust hours to 12-hour format
catalanHour = mod(hours-1, 12)+1;
nextHour = mod(hours, 12)+1;
Then to defining the numbers in catalan. It's worth noting that because the hours are feminine and the minutes are masculine, the words for 1 and 2 is different too (this is not too weird as languages go, in fact for my native Welsh there's a similar pattern between 2 and 4).
% Define the numbers in Catalan
catNumbers.masc = ["un", "dos", "tres", "quatre", "cinc"];
catNumbers.fem = ["una", "dues", "tres", "quatre",...
"cinc", "sis", "set", "vuit",...
"nou", "deu", "onze", "dotze"];
Okay, now it's starting to get serious! I mentioned before that this traditional time telling system is centred around the quarters — and that is true, but you'll also hear about the mig de quart (half of a quarter) * which is why we needed that seconds' precision from earlier!
% Define 07:30 intervals around the clock from 0 to 60
timeMarks = 0:15/2:60;
timeFraction = minutes + seconds / 60; % get the current position
[~, idx] = min(abs(timeFraction - timeMarks)); % extract the closest timeMark
mins = round(timeFraction - timeMarks(idx)); % round to the minute
After getting the fraction of the hour that we'll use later to tell the time, we can look into how many minutes it differs from that set time, using menys (less than) and i (on top of). There's also a bit of an AM/PM distinction, so you can use this function and know whether it's morning or night!
% Determine the minute string (diffString logic)
diffString = '';
if mins < 0
diffString = sprintf(' menys %s', catNumbers.masc(abs(mins)));
elseif mins > 0
diffString = sprintf(' i %s', catNumbers.masc(abs(mins)));
end
% Determine the part of the day (partofDay logic)
if hours < 12
partofDay = 'del matí'; % Morning (matí)
elseif hours < 18
partofDay = 'de la tarda'; % Afternoon (tarda)
elseif hours < 21
partofDay = 'del vespre'; % Evening (vespre)
else
partofDay = 'de la nit'; % Night (nit)
end
% Determine 'en punt' (o'clock exactly) based on minutes
enPunt = '';
if mins == 0
enPunt = ' en punt';
end
Now all that's left to do is define the main part of the string, which is which mig quart we are in. Since we extracted the index idx earlier as the closest timeMark, it's just a matter of indexing into this after the strings have been defined.
% Create the time labels
labels = {sprintf('són les %s%s%s %s', catNumbers.fem(catalanHour), diffString, enPunt, partofDay), ...
sprintf('és mig quart de %s%s %s', catNumbers.fem(nextHour), diffString, partofDay), ...
sprintf('és un quart de %s%s %s', catNumbers.fem(nextHour), diffString, partofDay), ...
sprintf('és un quart i mig de %s%s %s', catNumbers.fem(nextHour), diffString, partofDay), ...
sprintf('són dos quarts de %s%s %s', catNumbers.fem(nextHour), diffString, partofDay), ...
sprintf('són dos quarts i mig de %s%s %s', catNumbers.fem(nextHour), diffString, partofDay), ...
sprintf('són tres quarts de %s%s %s', catNumbers.fem(nextHour), diffString, partofDay), ...
sprintf('són tres quarts i mig de %s%s %s', catNumbers.fem(nextHour), diffString, partofDay), ...
sprintf('són les %s%s%s %s', catNumbers.fem(nextHour), diffString, enPunt, partofDay)};
catalanTime = labels{idx};
Then we need to do some clean up — the definite article les / la and the preposition de don't play nice with un and the initial vowel in onze, so there's a little replacement lookup here.
% List of old and new substrings for replacement
oldStrings = {'les un', 'són la una', 'de una', 'de onze'};
newStrings = {'la una', 'és la una', 'd''una', 'd''onze'};
% Apply replacements using a loop
for i = 1:length(oldStrings)
catalanTime = strrep(catalanTime, oldStrings{i}, newStrings{i});
end
end
quinahora()
ans = 'és un quart i mig de nou menys tres del vespre'
So, can you work out what time it was when I made this post? 🤔
And how do you tell the time in your language?
Fins després!
📢 We want to hear from you! We're a team of graduate student researchers at the University of Michigan studying MATLAB Drive and other cloud-based systems for sharing coding files. Your feedback will help improve these tools. Take our quick survey here: https://forms.gle/DnHs4XNAwBZvmrAw6
Hello,
I hope you are doing well. I need your help in developing a Matlab model for the modeling and simulation of the energy and environmental performance of an improved stove (furnace) for the combustion of charcoal briquettes (biochar). I would really appreciate your assistance.
Thank you very much.
Wan Muhamad Hakimi
Wan Muhamad Hakimi
Last activity on 14 Mar 2025 at 17:27

Hi! I am using F28379D DSP. I would like to generate 20khz and 50% duty cycle. I have use ADC with the input 3Vac from voltage sensor. The TBPRD set is 2500 and the CMP value is 1250 with prescaler 1. EPWM1A and EPWM 1B are utilised in this case. Unfortunately EPWM1A duty cycle is shifting/moving/not in phase, EPWM1B is constantly producing 20khz. I am using updown counter. CAU is set CAD is Clear same goes to EPWM1B. Why this happen? I would like to do a switching where PWM 20khz is on during positive half cycle, PWM 20khz is off during negative half cycle. Appreciate for the help!

Hello MATLAB Community,
I'm working on a project where I need to model and simulate a generator or motor system in Simulink, and I want to get the output voltage based on certain design parameters, including the number of turns, magnets, and coils.
I’m looking for a Simulink model or component that would allow me to input:
  • The number of turns in the coils
  • The number of magnets
  • The number of coils
And then, based on this design, output the voltage generated by the system.
I would appreciate any guidance on:
  • Specific Simulink components or models that are suited for this purpose
  • Whether there’s a prebuilt block or if I need to build a custom model
  • Any tips or examples that can help me set up this simulation
Thanks in advance for your help!
Best regards,
Siyabonga