Main Content

Results for

Hi!

I’m facing a problem in which I need an “intermediate” level of detail for my simulation.

In my case, I’d like to simulate a radar altimeter flying at low altitude over some terrain or sea. Over this surface, suppose to have an obstacle (tree/house/ship/…). I know everything about my altimeter (pulsed radar, frenquency, pulse duration, beam width, …). A possible outcome of such a simulation could be the assessment of the impact of different gain patterns on the received pulse.

What I have always found on the internet are either too simple solution (like solving the radar equations) or too complex (Method of Moments, or similar approaches).

Regarding the radar equation, I have always wandered how it can deal with the echoes coming from the outer regions of the beamwidth of the altimeter antenna (the equation only has the boresight gain as input parameter).

On the other hand, in my opinion, approaches like MoM are really too complicated and beyond my scope.

I had a look and tried to implement some of the Matlab functions that already exist (e.g., the ones on the FMCW Radar Altimeter Simulation example), but I don’t think they meet my needs.

So I decided to try to write my own code, providing the shape of the terrain/sea surface, the shape for the obstacles (for now, just simple shapes)… I guess I’d have to sample the domain, evaluating the echoes for all these elements… however, even in this case there are a lot of parameters that I don’t know how to handle properly, for example: - is it reasonable to discretize terrain or sea instead of assuming some model for the backscatter? - how should the domain be discretized? - how can I guarantee the conservation of power, considering the effects of the radiation pattern of the antenna and the aforementioned discretization of the domain?

Thanks in advance for your support.

Best regards, Alessandro

In one of my MATLAB projects, I want to add a button to an existing axes toolbar. The function for doing this is axtoolbarbtn:
axtoolbarbtn(tb,style,Name=Value)
However, I have found that the existing interfaces and behavior make it quite awkward to accomplish this task.
Here are my observations.
Adding a Button to the Default Axes Toolbar Is Unsupported
plot(1:10)
ax = gca;
tb = ax.Toolbar
Calling axtoolbarbtn on ax results in an error:
>> axtoolbarbtn(tb,"state")
Error using axtoolbarbtn (line 77)
Modifying the default axes toolbar is not supported.
Default Axes Toolbar Can't Be Distinguished from an Empty Toolbar
The Children property of the default axes toolbar is empty. Thus, it appears programmatically to have no buttons, just like an empty toolbar created by axtoolbar.
cla
plot(1:10)
ax = gca;
tb = ax.Toolbar;
tb.Children
ans = 0x0 empty GraphicsPlaceholder array.
tb2 = axtoolbar(ax);
tb2.Children
ans = 0x0 empty GraphicsPlaceholder array.
A Workaround
An empty axes toolbar seems to have no use except to initalize a toolbar before immediately adding buttons to it. Therefore, it seems reasonable to assume that an axes toolbar that appears to be empty is really the default toolbar. While we can't add buttons to the default axes toolbar, we can create a new toolbar that has all the same buttons as the default one, using axtoolbar("default"). And then we can add buttons to the new toolbar.
That observation leads to this workaround:
tb = ax.Toolbar;
if isempty(tb.Children)
% Assume tb is the default axes toolbar. Recreate
% it with the default buttons so that we can add a new
% button.
tb = axtoolbar(ax,"default");
end
btn = axtoolbarbtn(tb);
% Then set up the button as desired (icon, callback,
% etc.) by setting its properties.
As workarounds go, it's not horrible. It just seems a shame to have to delete and then recreate a toolbar just to be able to add a button to it.
The worst part about the workaround is that it is so not obvious. It took me a long time of experimentation to figure it out, including briefly giving it up as seemingly impossible.
The documentation for axtoolbarbtn avoids the issue. The most obvious example to write for axtoolbarbtn would be the first thing every user of it will try: add a toolbar button to the toolbar that gets created automatically in every call to plot. The doc page doesn't include that example, of course, because it wouldn't work.
My Request
I like the axes toolbar concept and the axes interactivity that it promotes, and I think the programming interface design is mostly effective. My request to MathWorks is to modify this interface to smooth out the behavior discontinuity of the default axes toolbar, with an eye towards satisfying (and documenting) the general use case that I've described here.
One possible function design solution is to make the default axes toolbar look and behave like the toolbar created by axtoolbar("default"), so that it has Children and so it is modifiable.
I am curious as to how my goal can be accomplished in Matlab.
The present APP called "Matching Network Designer" works quite well, but it is limited to a single section of a "PI", a "TEE", or an "L" topology circuit.
This limits the bandwidth capability of the APP when the intended use is to create an amplifier design intended for wider bandwidth projects.
I am requesting that a "Broadband Matching Network Designer" APP be developed by you, the MathWorks support team.
One suggestion from me is to be able to cascade a second section (or "pole") to the first.
Then the resulting topology would be capable of achieving that wider bandwidth of the microwave amplifier project where it would be later used with the transistor output and input matching networks.
Instead of limiting the APP to a single frequency, the entire s parameter file would be used as an input.
The APP would convert the polar s parameters to rectangular scaler complex impedances that you already use.
At that point, having started out with the first initial center frequency, the other frequencies both greater than and less than the center would come into use by an optimization of the circuit elements.
I'm hoping that you will be able to take on this project.
I can include an attachment of such a Matching Network Designer APP that you presently have if you like.
That network is centered at 10 GHz.
Kimberly Renee Alvarez.
310-367-5768
私の場合、前の会社が音楽認識アプリの会社で、アルゴリズム開発でFFTが使われていたことがきっかけでした。でも、MATLABのすごさが分かったのは、機械学習のオンライン講座で、Andrew Ngが、線型代数を使うと、数式と非常に近い構文のコードで問題が処理できることを学んだ時でした。
Three former MathWorks employees, Steve Wilcockson, David Bergstein, and Gareth Thomas, joined the ArrayCast pod cast to discuss their work on array based languages. At the end of the episode, Steve says,
> It's a little known fact about MATLAB. There's this thing, Gareth has talked about the community. One of the things MATLAB did very, very early was built the MATLAB community, the so-called MATLAB File Exchange, which came about in the early 2000s. And it was where people would share code sets, M files, et cetera. This was long before GitHub came around. This was well ahead of its time. And I think there are other places too, where MATLAB has delivered cultural benefits over and above the kind of core programming and mathematical capabilities too. So, you know, MATLAB Central, File Exchange, very much saw the future.
Dears,
I am running a MS-DSGE model using RISE toolbox. I want to add a fiscal shock and examine its effect on output, price...
%fiscal shock
shock_type = {'eps_G'};
%here is my variable list of a cell array of character variables and not a struct.
var_list={'log_y','C','pi_ann','B_nominal','B','sp','i_ann','r_real_ann','P'};
% EXOGENOUS SWITCHING
myirfs1=irf(m1,'irf_periods',24,'irf_shock_sign',1);
% following the suggestion by @VBBV, I use the following sintaxes to access elements of struct
myirfs1 = struct()
myirfs1.eps_CP = struct();
myirfs1.eps_G = struct();
myirfs1.eps_T = struct();
myirfs1.eps_a = struct();
myirfs1.eps_nu = struct();
myirfs1.eps_z = struct();
var_aux = {'log_y','C','pi_ann','B_nominal','B','sp','i_ann','r_real_ann','P'};
var_aux3 = {'eps_G_log_y','eps_G_C','eps_G_pi_ann','eps_G_B_nominal','eps_G_B','eps_G_sp','eps_G_i_ann','eps_G_r_real_ann','eps_G_P'};
fieldnames(myirfs1)
myirfs1.eps_G.var = var_aux3 % assign the data array to the struct variable
irf_fisc = struct();
for i = 1:numel(var_aux)
irf_fisc.var_aux{i} = [0,myirfs1.eps_G.var{i}]';
end
irf_fisc.var_aux(1)
irf_fisc
% what is the write syntax to assign value (simulated data) to the struct?
myirfs1.eps_G.logy = data(:,1)/10; %Is the suggested code. but where is the data variable located? should I create it data = randn(TMax, N); or it is already simulated?
Dears,
I need your help. hocan I access the subfields within eps_G, where eps_G is a structure.
whos myirfs1
Name Size Bytes Class Attributes
myirfs1 1x1 374094 struct
%% disp(fieldnames(myirfs1))
>> disp(fieldnames(myirfs1))
{'eps_CP'}
{'eps_G' }
{'eps_T' }
{'eps_a' }
{'eps_nu'}
{'eps_z' }
% choose 1 or 2 below
shock_type = {'eps_G','eps_nu'};
var_aux = {'log_y','C','pi_ann','B_nominal','B','sp','i_ann','r_real_ann','P'};
var_aux2 = {'log_y_eps_nu','C_eps_nu','pi_ann_eps_nu','B_nominal_eps_nu','B_eps_nu','sp_eps_nu','i_ann_eps_nu','r_real_ann_eps_nu','P_eps_nu'};
var_aux3 = {'eps_G_log_y','eps_G_C','eps_G_pi_ann','eps_G_B_nominal','eps_G_B','eps_G_sp','eps_G_i_ann','eps_G_r_real_ann','eps_G_P'};
%Irfs of monetary and fiscal policy
irf_mon = struct();
irf_fisc = struct();
%% disp(fieldnames(myirfs1))
>> disp(fieldnames(myirfs1))
{'eps_CP'}
{'eps_G' }
{'eps_T' }
{'eps_a' }
{'eps_nu'}
{'eps_z' }
% when i run the following code it is unrecognized. can you suggest me what to do?
for i = 1:numel(var_aux)
irf_mon.(var_aux{i}) = [0,myirfs1(1).(var_aux3{i})]';
irf_fisc.(var_aux{i}) = [0,myirfs1(1).(var_aux3{i})]';
end
Unrecognized field name "log_y_eps_G".
Walter Roberson
Walter Roberson
Last activity on 17 May 2025 at 15:41

This topic is for discussing highlights to the current R2025a Pre-release.
So you've downloaded the R2025a pre-release, tried Dark mode and are wondering what else is new. A lot! A lot is new!
One thing I am particularly happy about is the fact that Apple Accelerate is now the default BLAS on Apple Silicon machines. Check it out by doing
>> version -blas
ans =
'Apple Accelerate BLAS (ILP64)'
If you compare this to R2024b that is using OpenBLAS you'll see some dramatic speed-ups in some areas. For example, I saw up to 3.7x speed-up for matrix-matrix multiplication on my M2 Mabook Pro and 2x faster LU factorisation.
Details regarding my experiments are in this blog post Life in the fast lane: Making MATLAB even faster on Apple Silicon with Apple Accelerate » The MATLAB Blog - MATLAB & Simulink . Back then you had to to some trickery to switch to Apple Accelerate, now its the default.
Steve Eddins
Steve Eddins
Last activity on 20 Jan 2025

I just published a blog post called "The Story of TIMEIT." I've been thinking about writing something like this ever since Mike Croucher's tic/toc blog post last spring.
There were a lot of opinions about TIMEIT expressed in the comments of that blog post, including some of mine.
My blog post today gives a more full history of the function, its design goals, and how it works. I thought it might prompt more discussion, so I'm creating this thread as a place for it.
If you are an interested user of TIMEIT, feel free to weigh in here with your thoughts. Perhaps the thread will influence MathWorks regarding what to do with TIMEIT, or with related performance measurement capabilities.
Hi
If you have used the playground and are familiar with its capabilities, I will be very interested in your opinion about the tool.
Thank you in advance for your reply/opinion.
At
I am trying to run a scipt I from File Exchange, but I am getting error "Error using fsolve (line 186) FSOLVE requires at least two input arguments" Can please help fix the error?
% Prepare the options for the solver
options = prepareOptionsForSolver(options, 'fsolve');
end
if nargin == 0
error(message('optim:fsolve:NotEnoughInputs')) (line 186)
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";
晓毓
晓毓
Last activity on 11 Jan 2025

但是为什么会显示我只有30天使用权,难道学生版只能用30天吗?
瑞

Last activity on 11 Jan 2025

% 读取语音信号
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.
Congratulations and thank you again for your outstanding contributions in 2024!
Let's celebrate what made 2024 memorable! Together, we made big impacts, hosted exciting events, and built new apps.
Resource links:
Zitian
Zitian
Last activity on 3 Jan 2025

Whether the computation of codes is still operating for matlab online after I close the website?