結果:
Hi everyone
The R2025a pre-release is now available to licensed users. I highly encourage you to download, give it a try and give us some feedback.
The first thing I tried was switching to Dark mode. Here's the magic
>> s = settings;
>> s.matlab.appearance.MATLABTheme.PersonalValue = "Dark";

% 读取语音信号
try
[audio, fs] = audioread('floating.m4a');
% 输出读取到的音频数据的基本信息
fprintf('成功读取m4a文件,音频数据长度: %d,采样频率: %d\n', length(audio), fs);
catch ME
warning('无法读取m4a文件,尝试转换为wav格式');
try
[audio, fs] = audioread('floating.wav');
% 输出读取到的音频数据的基本信息
fprintf('成功读取wav文件,音频数据长度: %d,采样频率: %d\n', length(audio), fs);
catch ME2
error('无法读取任何格式的音频文件,错误信息: %s', ME2.message);
end
end
% 检查audio的数据类型
if ~isnumeric(audio)
audio = double(audio);
end
% 如果是多通道音频,转换为单通道
if size(audio, 2) > 1
audio = audio(:, 1);
end
% 对信号进行填充,使其长度为2的幂次方
len = length(audio);
next_pow2 = pow2(nextpow2(len));
if len < next_pow2
padding = zeros(next_pow2 - len, 1);
audio = [audio; padding];
end
% 检查audio是否为向量且非空
if ~isvector(audio) || isempty(audio)
error('audio必须是一个非空向量');
end
% 检查audio中的元素是否都是实数
if ~all(isreal(audio))
non_real_indices = find(~isreal(audio));
audio(non_real_indices) = real(audio(non_real_indices));
fprintf('检测到并处理了非实数元素\n');
end
% 再次确认audio的数据类型为double
if ~strcmp(class(audio), 'double')
audio = double(audio);
end
% 检查audio数据的统计信息
audio_mean = mean(audio);
audio_std = std(audio);
fprintf('音频数据的均值: %f,标准差: %f\n', audio_mean, audio_std);
% 调试输出audio的部分信息
fprintf('去噪前音频数据的前5个值: %f, %f, %f, %f, %f\n', audio(1), audio(2), audio(3), audio(4), audio(5));
% 1. 去噪
% 检查分解层数是否合理
max_decomposition_level = floor(log2(length(audio)));
if decomposition_level > max_decomposition_level
warning('设置的分解层数过高,将调整为最大可能层数 %d', max_decomposition_level);
decomposition_level = max_decomposition_level;
else
decomposition_level = 3;
end
% 检查小波函数、阈值规则等参数
valid_wavelets = {'sym4', 'db1', 'db2', 'haar'}; % 一些常见的有效小波函数
if ~ismember('sym4', valid_wavelets)
error('当前小波函数不被支持,请更换为有效的小波函数');
end
valid_threshold_rules = {'sqtwolog', 'rigrsure', 'heursure', 'minimaxi'}; % 一些常见的有效阈值规则
if ~ismember('sqtwolog', valid_threshold_rules)
error('当前阈值选择规则不被支持,请更换为有效的阈值规则');
end
% 尝试使用wdencmp函数进行小波去噪
% 这里设置KeepAPP为1,表示保留近似系数
[denoised_audio,~,~] = wdencmp('gbl', audio,'sym4', decomposition_level, 'sqtwolog', 'h', 1);
% 去除填充部分
denoised_audio = denoised_audio(1:len);
% 2. 归一化
normalized_audio = denoised_audio / max(abs(denoised_audio));
% 3. 加窗和分帧
window_size = 256; % 窗长
frame_shift = 128; % 帧移
window = hamming(window_size); % 汉明窗
% 分帧
num_frames = floor((length(normalized_audio) - window_size) / frame_shift) + 1;
frames = zeros(window_size, num_frames);
for i = 1:num_frames
start_index = (i - 1) * frame_shift + 1;
frames(:, i) = normalized_audio(start_index:start_index + window_size - 1).* window;
end
% 4. 频谱分析
% 使用spectrogram函数
noverlap = window_size - frame_shift;
[S, F, T] = spectrogram(normalized_audio, window, noverlap, num_fft, fs);
S = 10 * log10(abs(S));
% 5. 绘制频谱图
figure;
surf(T, F, S);
shading interp;
xlabel('Time (s)');
ylabel('Frequency (Hz)');
zlabel('Magnitude (dB)');
title('Spectrogram of Speech Signal');
>> Untitled3
成功读取m4a文件,音频数据长度: 479232,采样频率: 48000
音频数据的均值: 0.000000,标准差: 0.019026
去噪前音频数据的前5个值: 0.000000, 0.000000, 0.000000, 0.000000, 0.000000
***************************************
ARGUMENTS ERROR
---------------------------------------
wdencmp ---> real(s) => 0 , expected
***************************************
错误使用 wdencmp (line 91)
Invalid argument value.
出错 Untitled3 (line 83)
[denoised_audio,~,~] = wdencmp('gbl', audio,'sym4', decomposition_level, 'sqtwolog', 'h', 1);
The Most Accepted Badge and Top Downloads Badge are two prestigious annual honors that recognize outstanding contributions in MATLAB Answers and File Exchange.
Most Accepted badge is awarded to the top 10 contributors whose answers received the most acceptances. Top Downloads badge goes to the top 10 contributors with the highest number of downloads for their submissions. Please note that, starting in 2025, the criteria for Top Downloaded Badge in will be adjusted to only count downloads from files created or updated in 2025.


In 2024, the recipients for Most Accepted are: @Voss, @Walter Roberson, @Star Strider, @Torsten, @Matt J, @Stephen23, @Steven Lord, @Hassaan, @Sam Chak, and @Cris LaPierre.
The recipients for Top Downloaded are: @Steve Miller, @Rodney Tan, @Yair Altman, @Chad Greene, @William Thielicke, @Seyedali Mirjalili, @John D'Errico, @Giampiero Campa, @Toshiaki Takeuchi, and @Zhaoxu Liu / slandarer.
Congratulations and thank you again for your outstanding contributions in 2024!
Whether the computation of codes is still operating for matlab online after I close the website?
How does MATLAB app designer call external. m functions after packaging into exe? Please note that this external function is not packaged into EXE. Who can help me! I have tried commands such as' addpath ',' filread ',' eval ', but after testing, none of them worked.
for optimization is matlab better or python?
Hi!
I'm working on optical systems and I'm searching for algorithms and methods to solve the problem of autofocus.
I've already tried a bisection method and some optimization methods, but now I'd like to find a way to use neural networks in order to have a very fast and very precise way to move the lenses of my system to the right focus position.
Do you have any idea of the network I can use and how can I properly use it?
For the tests I'm using a setup made by an optical target, an objective and a sensor fixed on a linear positioner which is controlled by two functions I wrote in Matlab to move it back and forward.
Thank you!
I am trying to stimulate a given 3rd order chebyyshev filter on microwave transmission lines, with given impeadances of 3.34874, 0.71170, 3.34874

This is my code:

This is the stimulation result:

The LTSpice Stimulation result for same circuit:

I wonder why my Matlab stimulation have no Chebyshev ripple and different attenuation?

Attaching the Photoshop file if you want to modify the caption.
can i add TMS320F28P55SJ launch pad to matlab simulik
Toolbox 全部入りの MATLAB ライセンス
67%
まだ持っていない Toolbox (下記にコメントください)
0%
MATLAB T シャツ
17%
MATLAB ルービックキューブ
0%
MATLAB 靴下
6%
MathWorks オフィス訪問チケット
11%
18 票
この場は MATLAB や Simulink を使っている皆さんが、気軽に質問や情報交換ができる場所として作られました。日本語でも気軽に投稿ができるように今回日本語チャネルを解説します。
ユーザーの皆様とのやり取りを通じて、みんなで知識や経験を共有し、一緒にスキルアップしていきましょう。 どうぞお気軽にご参加ください。
そして日本語チャネル開設にあたってコメントくださった皆様、ありがとうございます!
Check out this 3D chart that won Visual Of The Year for 2024 by Visual Capitalist. It's a mashup between a 3D bubblechart and a categorical bar plot yet the only graphical components are the x-axis labels and the legend. Not only does it show relative proportions of material in a laptop but it also shows what the raw material looks like.
I love the idea of analog data visualization. I wonder if any readers have made a analog "chart".

What better way to add a little holiday magic than the L-shaped membrane atop your evergreen? My colleagues output the shape and then added some thickness and an interior cylinder in Blender. Then, the shape was exported to STL and 3D printed (in several pieces). Then glued, sanded, primed, sanded again and painted. If you like, the STL file is attached. Thank you to https://blogs.mathworks.com/community/2013/06/20/paul-prints-the-l-shaped-membrane/ and a tip of the hat to MATLAB Ornament. Happy Holidays!


hello
someone who has already done this course can help me please?
in the represent power system component point there are a task whitout solution. i don´t know if its a mistake or im doing it wrong. the of the second module. i have done al the step they ask me to but the simulation still not working. i have followed the solution steps to see if its me but no, the simulation still not working. in the follow image as you can see this is the correct way to solve the problem but does not work

The MATLAB Online Training Suite has been updated in the areas of Deep Learning and traditional Machine Learning! These are great self-paced courses that can get you from zero to hero pretty quickly.
Deep Learning Onramp (Free to everyone!) has been updated to use the dlnetwork workflow, such as the trainnet function, which became the preferred method for creating and training deep networks in R2024a.
- Content streamlined to reduce the focus on data processing and feature extraction, and emphasize the machine learning workflow.
- Course example simplified by using a sample of the original data.
- Classification Learner used in the course where appropriate.
The rest of the updates are for subscribers to the full Online Training Suite
The Deep Learning Techniques in MATLAB for Image Applications learning path teaches skills to tackle a variety of image applications. It is made up of the following four short courses:
- Explore Convolutional Neural Networks
- Tune Deep Learning Training Options
- Regression with Deep Learning
- Object Detection with Deep Learning
Two more deep learning short courses are also available:
The Machine Learning Techniques in MATLAB learning path helps learners build their traditional machine learning skill set:
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?
I have a problem with the movement of a pawn by two fields in its first move does anyone have a suggestion for a solution
function chess_game()
% Funkcja główna inicjalizująca grę w szachy
% Inicjalizacja stanu gry
gameState = struct();
gameState.board = initialize_board();
gameState.currentPlayer = 'white';
gameState.selectedPiece = [];
% Utworzenie GUI
fig = figure('Name', 'Gra w Szachy', 'NumberTitle', 'off', 'MenuBar', 'none', 'UserData', gameState);
ax = axes('Parent', fig, 'Position', [0 0 1 1], 'XTick', [], 'YTick', []);
axis(ax, [0 8 0 8]);
hold on;
% Wyświetlenie planszy
draw_board(ax, gameState.board);
% Obsługa kliknięcia myszy
set(fig, 'WindowButtonDownFcn', @(src, event)on_click(ax, src));
end
function board = initialize_board()
% Inicjalizuje planszę z ustawieniem początkowym figur
board = {
'R', 'N', 'B', 'Q', 'K', 'B', 'N', 'R';
'P', 'P', 'P', 'P', 'P', 'P', 'P', 'P';
'', '', '', '', '', '', '', '';
'', '', '', '', '', '', '', '';
'', '', '', '', '', '', '', '';
'', '', '', '', '', '', '', '';
'p', 'p', 'p', 'p', 'p', 'p', 'p', 'p';
'r', 'n', 'b', 'q', 'k', 'b', 'n', 'r';
};
end
function draw_board(~, board)
% Rysuje szachownicę i figury
colors = [1 1 1; 0.8 0.8 0.8];
for row = 1:8
for col = 1:8
% Rysowanie pól
rectColor = colors(mod(row + col, 2) + 1, :);
rectangle('Position', [col-1, 8-row, 1, 1], 'FaceColor', rectColor, 'EdgeColor', 'k');
% Rysowanie figur
piece = board{row, col};
if ~isempty(piece)
text(col-0.5, 8-row+0.5, piece, 'HorizontalAlignment', 'center', ...
'FontSize', 20, 'FontWeight', 'bold');
end
end
end
end
function on_click(ax, fig)
% Funkcja obsługująca kliknięcia myszy
pos = get(ax, 'CurrentPoint');
x = floor(pos(1,1)) + 1; % Zaokrąglij współrzędne w poziomie i dopasuj do indeksów
y = 8 - floor(pos(1,2)); % Dopasuj współrzędne w pionie (odwrócenie osi Y)
% Pobranie stanu gry z figury
gameState = get(fig, 'UserData');
if x >= 1 && x <= 8 && y >= 1 && y <= 8
disp(['Kliknięto na pole: (', num2str(x), ', ', num2str(y), ')']);
if isempty(gameState.selectedPiece)
% Wybór figury
piece = gameState.board{y, x};
if ~isempty(piece)
if (strcmp(gameState.currentPlayer, 'white') && any(ismember(piece, 'RNBQKP'))) || ...
(strcmp(gameState.currentPlayer, 'black') && any(ismember(piece, 'rnbqkp')))
gameState.selectedPiece = [y, x];
disp(['Wybrano figurę: ', piece, ' na pozycji (', num2str(x), ', ', num2str(y), ')']);
else
disp('Nie możesz wybrać tej figury.');
end
else
disp('Nie wybrano figury.');
end
else
% Sprawdzenie, czy kliknięto ponownie na wybraną figurę
if isequal(gameState.selectedPiece, [y, x])
disp('Anulowano wybór figury.');
gameState.selectedPiece = [];
else
% Ruch figury
[sy, sx] = deal(gameState.selectedPiece(1), gameState.selectedPiece(2));
piece = gameState.board{sy, sx};
if is_valid_move(gameState.board, piece, [sy, sx], [y, x], gameState.currentPlayer)
% Wykonanie ruchu
gameState.board{sy, sx} = ''; % Usuwamy figurę z poprzedniego pola
gameState.board{y, x} = piece; % Umieszczamy figurę na nowym polu
gameState.selectedPiece = [];
% Przełącz gracza
gameState.currentPlayer = switch_player(gameState.currentPlayer);
% Odśwież planszę
cla(ax);
draw_board(ax, gameState.board);
else
disp('Ruch niezgodny z zasadami.');
end
end
end
% Zaktualizowanie stanu gry w figurze
set(fig, 'UserData', gameState);
end
end
function valid = is_valid_move(board, piece, from, to, currentPlayer)
% Funkcja sprawdzająca, czy ruch jest poprawny
[sy, sx] = deal(from(1), from(2));
[dy, dx] = deal(to(1), to(2));
dy_diff = dy - sy;
dx_diff = abs(dx - sx);
targetPiece = board{dy, dx};
% Sprawdzenie, czy ruch jest w granicach planszy
if dx < 1 || dx > 8 || dy < 1 || dy > 8
valid = false;
return;
end
% Nie można zbijać swoich figur
if ~isempty(targetPiece) && ...
((strcmp(currentPlayer, 'white') && ismember(targetPiece, 'RNBQKP')) || ...
(strcmp(currentPlayer, 'black') && ismember(targetPiece, 'rnbqkp')))
valid = false;
return;
end
% Zasady ruchu dla każdej figury
switch lower(piece)
case 'p' % Pion
direction = strcmp(currentPlayer, 'white') * 2 - 1; % 1 dla białych, -1 dla czarnych
startRow = strcmp(currentPlayer, 'white') * 2 + 1; % Rząd startowy dla białych i czarnych
if isempty(targetPiece)
% Ruch o jedno pole do przodu
if dy_diff == direction && dx_diff == 0
valid = true;
% Ruch o dwa pola do przodu z pozycji startowej
elseif dy_diff == 2 * direction && dx_diff == 0 && sy == startRow
if isempty(board{sy + direction, sx}) && isempty(board{dy, dx})
valid = true;
else
valid = false;
end
else
valid = false;
end
else
% Zbijanie na ukos
valid = (dx_diff == 1) && (dy_diff == direction);
end
case 'r' % Wieża
valid = (dx_diff == 0 || dy_diff == 0) && path_is_clear(board, from, to);
case 'n' % Skoczek
valid = (dx_diff == 2 && abs(dy_diff) == 1) || (dx_diff == 1 && abs(dy_diff) == 2);
case 'b' % Goniec
valid = (dx_diff == abs(dy_diff)) && path_is_clear(board, from, to);
case 'q' % Hetman
valid = ((dx_diff == 0 || dy_diff == 0) || (dx_diff == abs(dy_diff))) && path_is_clear(board, from, to);
case 'k' % Król
valid = max(abs(dx_diff), abs(dy_diff)) == 1;
otherwise
valid = false;
end
end
function clear = path_is_clear(board, from, to)
% Sprawdza, czy ścieżka między polami jest wolna od innych figur
[sy, sx] = deal(from(1), from(2));
[dy, dx] = deal(to(1), to(2));
stepY = sign(dy - sy);
stepX = sign(dx - sx);
y = sy + stepY;
x = sx + stepX;
while y ~= dy || x ~= dx
if ~isempty(board{y, x})
clear = false;
return;
end
y = y + stepY;
x = x + stepX;
end
clear = true;
end
function nextPlayer = switch_player(currentPlayer)
% Przełącza aktywnego gracza
if strcmp(currentPlayer, 'white')
nextPlayer = 'black';
else
nextPlayer = 'white';
end
end
Watt's Up with Electric Vehicles?EV modeling Ecosystem (Eco-friendly Vehicles), V2V Communication and V2I communications thereby emitting zero Emissions to considerably reduce NOx ,Particulates matters,CO2 given that Combustion is always incomplete and will always be.
Reduction of gas emissions outside to the environment will improve human life span ,few epidemic diseases and will result in long life standard