Main Content

Results for

We will be updating the MATLAB Answers infrastructure at 1PM EST today. We do not expect any disruption of service during this time. However, if you notice any issues, please be patient and try again later. Thank you for your understanding.
adem
adem
Last activity on 20 Dec 2024

Objectif : Etude d'une chaine de transmission numérique avec des turbo-codes combiné avec la technique HARQ (Hybrid Automatic Repeat reQuest):
* Mettre en place une chaîne de transmission numérique avec des turbo codes intégrant la technique HARQ.
* Évaluer les performances de cette chaîne, en termes de taux d'erreur et de débit sous diverses conditions de canal.
En structurant ainsi votre étude, vous pourrez mener une analyse approfondie des turbo codes et de la technique HARQ.
Outils : Utilisez des outils comme MATLAB, Simulink ou Python (avec des bibliothèques comme Scipy pour la modélisation des canaux et NumPy pour la gestion des calculs).
Simulations : Créez une série de simulations en variant les paramètres comme le SNR, le type de HARQ utilisé, etc.
Compétences développées : Maîtrise des techniques de détection et de correction d’erreurs pour améliorer la fiabilité des transmissions
AHD
AHD
Last activity on 9 Dec 2024

Hello,
Anyone has basic MATLAB code upon RSMA i.e. to understand basic implementation of RSMA, how to generate common and private messages in MATLAB, etc...?
Always and almost immediately!
26%
Never
30%
After validating existing code
15%
Y'all get the new releases?
29%
1843 votes
Mike Croucher
Mike Croucher
Last activity on 7 Dec 2024

Many of my best friends at MathWorks speak Spanish as their first language and we have a large community of Spanish-speaking users. You can see good evidence of this by checking out our relatively new Spanish YouTube channel which recently crossed the 10,000 subscriber mark
For a project that i am working on, I have to deal with a set of 36 superheated steam tables in one of 3 sheets in an excel file. Since the tables are organized as a set of 5 columns (T,V,U,H,S) with a Pressure "title", but Pressure is a variable I need to be able to read, I want to go about converting the pressure into the first column (unless there is an easier way) of each table where for the length of that table (27 rows) the pressure is the same even as the other variables change (like a matrix). However when I did that I faced a number of issues:
1. the tables didn't separate properly so it combined into 3 tables which is incorrect
2. The pressure column was created but didn't fill with numbers so all showed NaN
3. The column names for the variables are different than my inputs (The columns are listed with units like T_C_ or U_kJ_kg_ and so on, but I need to be able to input any 2 properties and get the rest and I need to be able to input them in the form of T and U and have it understand what columns I am looking for.
3a. When I tried to replace the variable names in the code, Since there are 3 tables it started giving me an error message that there are duplicates of properties when there shouldn't be because they should all be different tables and I want it to recognize that.
Here is a bit of what my table looks like: Please help
TOMBET
TOMBET
Last activity on 6 Dec 2024

Apart optimize angle by Lagrange equation, how many methodes have we about anti-swing for the stabilisation of gantry crane while loading and unloading contenainers? thank you a lot.
TOMBET
TOMBET
Last activity on 6 Dec 2024

hello !! Can we design a control method in backstepping for second order? and how to design it? thank you for all.
Mike Croucher
Mike Croucher
Last activity on 13 Dec 2024

I've always used MATLAB with other languages. In the early days, C and C++ via mex files were the most common ways I spliced two languages together. Other than that I've also used MATLAB with Java, Excel and even Fortran.
In more recent years, Python is the language I tend to use most alongside MATLAB and support for this combination is steadily improving. In my latest blog post, I show how easy it has become to use Python's Numpy with MATLAB.
Have you used this functionality much? If so, what for? How well did it work for you?
I am inspired by the latest video from YouTube science content creator Veritasium on his distinct yet thorough explanation on how rainbows work. In his video, he set up a glass sphere experiment representing how light rays would travel inside a raindrop that ultimately forms the rainbow. I highly recommend checking it out.
In the meantime, I created an interactive MATLAB App in MATLAB Online using App Designer to visualize the light paths going through a spherical raindrop with numerical calculations along the way. While I've seen many diagrams out there showing the light paths, I haven't found any doing calculations in each step. Hence I created an app in MATLAB to show the calculations along with the visualizations as one varies the position of the incoming light ray.
Demo video:
For more information about the app and how to open it and play around with it in MATLAB Online, please check out my blog article:
Our MathWorks Usability Team is working on an accessibility project and they want to interview people who use MATLAB and also have experience with screen readers.
If you fit the criteria and are interested, sign up here https://www.mathworks.com/products/usability.html?tfa_30=A11Y
I wish I knew more about the intended evolution of the capabilities of the function arguments block. I love implementing function syntaxes using this relatively new form, but it doesn't yet handle some function syntax design patterns that I think are valuable and worth keeping.
For example, some functions take an input quantity that can something numeric, or it can be an option string that descriptively names a particular value of that quantity. One example is dateshift(t,"dayofweek",dow), where dow can be an integer from 1 to 7, or it can be one of the option strings "weekday" or "weekend".
Another example is Image Processing Toolbox that take a connectivity specifier as input. The function bwconncomp is one particular case. Connectivity can be specified using certain scalars, certain arrays, or the option string "maximal".
I think this is a worthwhile function design pattern, but I don't think the arguments block validation functionality supports it well (unless you use a lot of extra code that duplicates standard MATLAB behavior, which undermines the value of the arguments block).
I posted about this today over on my blog. See "Function Syntax Design Conundrum."
MathWorkers - believe me, I know that it is not in your DNA to discuss future features. But would anyone care to offer a hint about directions for the arguments block functionality?
I am very excited to share my new book "Data-driven method for dynamic systems" available through SIAM publishing: https://epubs.siam.org/doi/10.1137/1.9781611978162
This book brings together modern computational tools to provide an accurate understanding of dynamic data. The techniques build on pencil-and-paper mathematical techniques that go back decades and sometimes even centuries. The result is an introduction to state-of-the-art methods that complement, rather than replace, traditional analysis of time-dependent systems. One can find methods in this book that are not found in other books, as well as methods developed exclusively for the book itself. I also provide an example-driven exploration that is (hopefully) appealing to graduate students and researchers who are new to the subject.
Each and every example for the book can be reproduced using the code at this repo: https://github.com/jbramburger/DataDrivenDynSyst
Hope you like it!
Image Analyst
Image Analyst
Last activity on 6 Jan 2025

Christmas season is underway at my house:
(Sorry - the ornament is not available at the MathWorks Merch Shop -- I made it with a 3-D printer.)
Mirhan
Mirhan
Last activity on 2 Dec 2024

Hi everyone,
I am performing an optimization analysis using MATLAB's Genetic Algorithm (GA) to select design variables, which are then passed to ANSYS to calculate some structural properties. My goal is to find the global optimum, so I have set the population size to 100 × number of variables. While this ensures a broader search space and reduces the risk of getting stuck in local optima, it significantly increases the convergence time because finite element analysis (FEA) needs to be performed for each population member. The current setup takes about a week (or more) to converge, which is not feasible.
To address this, I plan to implement parallel computing for the GA. I need help with the following aspects:
  1. Parallel Implementation:On my local desktop, I have Number of workers: 6, which means I can evaluate 6 members of the population simultaneously. However, I want to make my code generic so that it automatically adjusts to the number of workers available on any machine. How can I achieve this in MATLAB?
  2. Improving Convergence Speed:Another approach I’ve come across is using the MigrationInterval and MigrationFractionoptions to divide the population into smaller "islands" that exchange solutions periodically. Would this approach be suitable in my case, and how can I implement it effectively?
  3. Objective Function Parallelization:Below is the current version of my objective function, which works without parallelization. It writes input variables to an ANSYS .inp file, runs the simulation, and reads results from a text file. How should I modify this function (if needed) to make it compatible with MATLAB’s parallel computing features?
function cost = simple_objective(x, L)
% Write input variables to the file
fid = fopen('Design_Variables.inp', 'w+'); % Ansys APDL reads this
fprintf(fid, 'H_head = %f\n', x(1));
fprintf(fid, 'R_top = %f\n', x(2));
fclose(fid);
% Set ANSYS and Run model
ansys_input = 'ANSYS_APDL.dat';
output_file = 'out_file.txt';
cmd = sprintf('SET KMP_STACKSIZE=15000k & "C:\\Program Files\\ANSYS Inc\\v232\\ansys\\bin\\winx64\\ANSYS232.exe" -b -i %s -o %s', ansys_input, output_file);
system(cmd);
% Remove file lock if it exists
if exist('file.lock', 'file')
delete('file.lock');
end
% Read results
fileID = fopen('PC1.txt', 'r');
load_multip = fscanf(fileID,'%f',[1,inf]);
fclose(fileID);
if load_multip == 0 % nondesignable geometry
cost = 1e9; % penalty
else
cost = -load_multip;
end
end
GA Options:
Here are the GA options I am currently using. Do I need to adjust these for parallelization or migration-based approaches?
“options = optimoptions("ga", ... 'OutputFcn',@SaveOut, ... 'Display', 'iter', ... 'PopulationSize', 200, ... 'Generations', 50, ... 'EliteCount', 2, ... 'CrossoverFraction', 0.98, ... 'TolFun', 1.0e-9, ... 'TolCon', 1.0e-9, ... 'StallTimeLimit', Inf, ... 'FitnessLimit', -Inf, ... 'PlotFcn',{@gaplotbestf,@gaplotstopping});”
I would greatly appreciate it if you could guide me on:
  • How to enable and configure parallel computing for GA in MATLAB.
  • Any adjustments required in the objective function for parallel execution.
  • Whether migration-based GA (using MigrationInterval and MigrationFraction) is a good alternative in my case.
Thank you for your time and help!
Hello,
I have a MATLAB App that has been devolped in the MATLAB App Designer. I have saved all of the apps properties when the user selects the save config menu option and saved it into a .mat file.
Now I want to be able to load this file and update the app to the properties saved in this file. Currently, the program will store the variables in the app structure, but will not update the app's UIFigure. If I save the the UIFigure itself the program will create a new UIFigure and the code in App Designer will no longer work. Hence, why I've added not to save the UIFigure.
if strcmp(propName, 'SuperMarioUIFigure')
continue;
end
Does anyone know how I can get the app structure to update the current UIFigure that App Designer is running?
Here is my current code.
% Menu selected function: SaveConfigMenu
function SaveConfigMenuSelected(app, event)
% Create a structure to hold all the properties of the app
config = struct();
% List all properties of the app
metaProps = properties(app);
% Loop through properties and store their values in structure
for i = 1:length(metaProps)
propName = metaProps{i};
if strcmp(propName, 'SuperMarioUIFigure')
continue;
end
try
config.(propName) = app.(propName);
catch
% Handle any properties that can't be saved
fprintf('Could not save property: %s\n', propName);
end
end
% Prompt user to specify a file to save the configuration
[file, path] = uiputfile('*.mat', 'Save Configuration As');
if isequal(file, 0) || isequal(path, 0)
return; % User cancelled
end
% Save the configuration structure to a file
save(fullfile(path, file), '-struct', 'config');
uialert(app.SuperMarioUIFigure, 'Configuration saved successfully!', 'Save Configuration');
end
% Menu selected function: LoadConfigMenu
function LoadConfigMenuSelected(app, event)
% Prompt user to select a configuration file
[file, path] = uigetfile('*.mat', 'Load Configuration');
if isequal(file, 0) || isequal(path, 0)
return; % User cancelled
end
% Load the configuration structure from the file
config = load(fullfile(path, file));
% List all properties of the app
metaProps = properties(app);
% Update app properties with values from the configuration file
for i = 1:length(metaProps)
propName = metaProps{i};
if isfield(config, propName)
try
app.(propName) = config.(propName);
catch ME
% Handle any properties that can't be updated
fprintf('Could not load property: %s. Error: %s\n', propName, ME.message);
end
end
end
% Display a success message
uialert(app.SuperMarioUIFigure, 'Configuration loaded successfully!', 'Load Configuration');
end
Thanks
Hello, I have a very simple Simulink program to control a servo with my Arduino. The problem is that I'm not getting a full range of the servo. I am using an Adafruit Motor Shield to drive the servo which is a cheap TowerPro. The range I'm getting is 0 to 70. I am using Matlab/Simulink 2019.
Any ideas what could be wrong?
Thank you
The expression for a zero-symmetric polyhedron is known, S={x:[1; 1]<=Ax<=[1; 1]}, where A=[0.5 0; -0.5 0; 0 0.25; 0 -0.25], can you use the polyhedron function to draw an image of the polyhedron, I hope you can write detailed code