主要内容

搜索


Joseff Bailey-Wood
Joseff Bailey-Wood
上次活动时间: 大约 2 小时 前

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 look 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!

Bonsoir

Je me permets de vous contacter afin d’obtenir des informations et un encadrement concernant un projet sur lequel je travaille actuellement. Il s’agit d’une application visant à réguler un oscillateur quantique en potentiel harmonique à l’aide de l’intelligence artificielle.

Plus précisément, mon objectif est de :

Modéliser l’évolution de l’oscillateur quantique sous un potentiel harmonique.

Appliquer des techniques d’IA (réseaux de neurones, renforcement, etc.) pour optimiser la régulation de son état.

Analyser les performances des algorithmes dans le cadre de cette régulation.

Je souhaiterais savoir si vous pourriez m’apporter des conseils ou un encadrement dans la réalisation de ce projet, notamment sur les aspects mathématiques, physiques et computationnels impliqués. De plus, toute suggestion sur des références bibliographiques ou des outils adaptés (MATLAB, Python, TensorFlow, etc.) serait également très précieuse.

Dans l’attente de votre retour, Bien cordialement,

Imagine you are developing a new toolbox for MATLAB. You have a folder full of a few .m files defining a bunch of functions and you are thinking 'This would be useful for others, I'm going to make it available to the world'
What process would you go through? What's the first thing you'd do?
I have my own opinions but don't want to pollute the start of the conversation :)
I am glad to inform and share with you all my new text book titled "Inverters and AC Drives
Control, Modeling, and Simulation Using Simulink", Springer, 2024. This text book has nine chapters and three appendices. A separate "Instructor Manual" is rpovided with solutions to selected model projects. The salent features of this book are given below:
  • Provides Simulink models for various PWM techniques used for inverters
  • Presents vector and direct torque control of inverter-fed AC drives and fuzzy logic control of converter-fed AC drives
  • Includes examples, case studies, source codes of models, and model projects from all the chapters
The Springer link for this text book is given below:
This book is also in the Mathworks book program:
It is time to support the cameraIntrinsics function to accept a 3-by-3 intrinsic matrix K as an input parameter for constructing the object. Currently, the built-in cameraIntrinsics function can only be constructed by explicitly specifying focalLength, principalPoint, and imageSize. This approach has drawbacks, as it is not very intuitive. In most application scenarios, using the intrinsic matrix
K=[fx,0,cx;
0,fy,cy;
0,0,1]
is much more straightforward and effective!
intrinsics = cameraIntrinsics(K)
Mike Croucher
Mike Croucher
上次活动时间: 2025-2-24,22:04

tiledlayout(4,1);
% Plot "L" (y = 1/(x+1), for x > -1)
x = linspace(-0.9, 2, 100); % Avoid x = -1 (undefined)
y =1 ./ (x+1) ;
nexttile;
plot(x, y, 'r', 'LineWidth', 2);
xlim([-10,10])
% Plot "O" (x^2 + y^2 = 9)
theta = linspace(0, 2*pi, 100);
x = 3 * cos(theta);
y = 3 * sin(theta);
nexttile;
plot(x, y, 'r', 'LineWidth', 2);
axis equal;
% Plot "V" (y = -2|x|)
x = linspace(-1, 1, 100);
y = 2 * abs(x);
nexttile;
plot(x, y, 'r', 'LineWidth', 2);
axis equal;
% Plot "E" (x = -3 |sin(y)|)
y = linspace(-pi, pi, 100);
x = -3 * abs(sin(y));
nexttile;
plot(x, y, 'r', 'LineWidth', 2);
axis equal;
Check out the result of "emoji matrix" multiplication below.
  • vector multiply vector:
a = ["😁","😁","😁"]
Warning: Function mtimes has the same name as a MATLAB built-in. We suggest you rename the function to avoid a potential name conflict.
Warning: Function mtimes has the same name as a MATLAB built-in. We suggest you rename the function to avoid a potential name conflict.
a = 1x3 string array
"😁" "😁" "😁"
b = ["😂";
"😂"
"😂"]
b = 3x1 string array
"😂" "😂" "😂"
c = a*b
c = "😁😂😁😂😁😂"
d = b*a
d = 3x3 string array
"😂😁" "😂😁" "😂😁" "😂😁" "😂😁" "😂😁" "😂😁" "😂😁" "😂😁"
  • matrix multiply matrix:
matrix1 = [
"😀", "😃";
"😄", "😁"]
matrix1 = 2x2 string array
"😀" "😃" "😄" "😁"
matrix2 = [
"😆", "😅";
"😂", "🤣"]
matrix2 = 2x2 string array
"😆" "😅" "😂" "🤣"
resutl = matrix1*matrix2
resutl = 2x2 string array
"😀😆😃😂" "😀😅😃🤣" "😄😆😁😂" "😄😅😁🤣"
enjoy yourself!
For Valentine's day this year I tried to do something a little more than just the usual 'Here's some MATLAB code that draws a picture of a heart' and focus on how to share MATLAB code. TL;DR, here's my advice
  1. Put the code on GitHub. (Allows people to access and collaborate on your code)
  2. Set up 'Open in MATLAB Online' in your GitHub repo (Allows people to easily run it)
I used code by @Zhaoxu Liu / slandarer and others to demonstrate. I think that those two steps are the most impactful in that they get you from zero to one but If I were to offer some more advice for research code it would be
3. Connect the GitHub repo to File Exchange (Allows MATLAB users to easily find it in-product).
4. Get a Digitial Object Identifier (DOI) using something like Zenodo. (Allows people to more easily cite your code)
There is still a lot more you can do of course but if everyone did this for any MATLAB code relating to a research paper, we'd be in a better place I think.
What do you think?
Los invito a conocer el libro "Sistemas dinámicos en contexto: Modelación matemática, simulación, estimación y control con MATLAB", el cual estará disponible pronto en formato digital.
El libro integra diversos temas de los sistemas dinámicos desde un punto de vista práctico utilizando programas de MATLAB y simulaciones en Simulink y utilizando métodos numéricos (ver enlace). Existe mucho material en el blog del libro con posibilidades para comentarios, propuestas y correcciones. Resalto los casos de estudio
Creo que el libro les puede dar un buen panorama del área con la posibilidad de experimentar de manera interactiva con todo el material de MATLAB disponible en formato Live Script. Lo mejor es que se pueden formular preguntas en el blog y hacer propuestas al autor de ejercicios resueltos.
Son bienvenidos los comentarios, sugerencias y correcciones al texto.
I got thoroughly nerd-sniped by this xkcd, leading me to wonder if you can use MATLAB to figure out the dice roll for any given (rational) probability. Well, obviously you can. The question is how. Answer: lots of permutation calculations and convolutions.
In the original xkcd, the situation described by the player has a probability of 2/9. Looking up the plot, row 2 column 9, shows that you need 16 or greater on (from the legend) 1d4+3d6, just as claimed.
If you missed the bit about convolutions, this is a super-neat trick
[v,c] = dicedist([4 6 6 6]);
bar(v,c)
% Probability distribution of dice given by d
function [vals,counts] = dicedist(d)
% d is a vector of number of sides
n = numel(d); % number of dice
% Use convolution to count the number of ways to get each roll value
counts = 1;
for k = 1:n
counts = conv(counts,ones(1,d(k)));
end
% Possible values range from n to sum(d)
maxtot = sum(d);
vals = n:maxtot;
end
MATLAB FEX(MATLAB File Exchange) should support Markdown syntax for writing. In recent years, many open-source community documentation platforms, such as GitHub, have generally supported Markdown. MATLAB is also gradually improving its support for Markdown syntax. However, when directly uploading files to the MATLAB FEX community and preparing to write an overview, the outdated document format buttons are still present. Even when directly uploading a Markdown document, it cannot be rendered. We hope the community can support Markdown syntax!
BTW,I know that open-source Markdown writing on GitHub and linking to MATLAB FEX is feasible, but this is a workaround. It would be even better if direct native support were available.
I am very pleased to share my book, with coauthors Professor Richard Davis and Associate Professor Sam Toan, titled "Chemical Engineering Analysis and Optimization Using MATLAB" published by Wiley: https://www.wiley.com/en-us/Chemical+Engineering+Analysis+and+Optimization+Using+MATLAB-p-9781394205363
Also in The MathWorks Book Program:
Chemical Engineering Analysis and Optimization Using MATLAB® introduces cutting-edge, highly in-demand skills in computer-aided design and optimization. With a focus on chemical engineering analysis, the book uses the MATLAB platform to develop reader skills in programming, modeling, and more. It provides an overview of some of the most essential tools in modern engineering design.
Chemical Engineering Analysis and Optimization Using MATLAB® readers will also find:
  • Case studies for developing specific skills in MATLAB and beyond
  • Examples of code both within the text and on a companion website
  • End-of-chapter problems with an accompanying solutions manual for instructors
This textbook is ideal for advanced undergraduate and graduate students in chemical engineering and related disciplines, as well as professionals with backgrounds in engineering design.
Too small
22%
Just right
38%
Too large
40%
2648 个投票
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が、線型代数を使うと、数式と非常に近い構文のコードで問題が処理できることを学んだ時でした。
Overview
Authors:
  • Narayanaswamy P.R. Iyer
  • Provides Simulink models for various PWM techniques used for inverters
  • Presents vector and direct torque control of inverter-fed AC drives and fuzzy logic control of converter-fed AC drives
  • Includes examples, case studies, source codes of models, and model projects from all the chapters.
About this book
Successful development of power electronic converters and converter-fed electric drives involves system modeling, analyzing the output voltage, current, electromagnetic torque, and machine speed, and making necessary design changes before hardware implementation. Inverters and AC Drives: Control, Modeling, and Simulation Using Simulink offers readers Simulink models for single, multi-triangle carrier, selective harmonic elimination, and space vector PWM techniques for three-phase two-level, multi-level (including modular multi-level), Z-source, Quasi Z-source, switched inductor, switched capacitor and diode assisted extended boost inverters, six-step inverter-fed permanent magnet synchronous motor (PMSM), brushless DC motor (BLDCM) and induction motor (IM) drives, vector-controlled PMSM, IM drives, direct torque-controlled inverter-fed IM drives, and fuzzy logic controlled converter-fed AC drives with several examples and case studies. Appendices in the book include source codes for all relevant models, model projects, and answers to selected model projects from all chapters. 
This textbook will be a valuable resource for upper-level undergraduate and graduate students in electrical and electronics engineering, power electronics, and AC drives. It is also a hands-on reference for practicing engineers and researchers in these areas.
  
I want to share a new book "Introduction to Digital Control - An Integrated Approach, Springer, 2024" available through https://link.springer.com/book/10.1007/978-3-031-66830-2.
This textbook presents an integrated approach to digital (discrete-time) control systems covering analysis, design, simulation, and real-time implementation through relevant hardware and software platforms. Topics related to discrete-time control systems include z-transform, inverse z-transform, sampling and reconstruction, open- and closed-loop system characteristics, steady-state accuracy for different system types and input functions, stability analysis in z-domain-Jury’s test, bilinear transformation from z- to w-domain, stability analysis in w-domain- Routh-Hurwitz criterion, root locus techniques in z-domain, frequency domain analysis in w-domain, control system specifications in time- and frequency- domains, design of controllers – PI, PD, PID, phase-lag, phase-lead, phase-lag-lead using time- and frequency-domain specifications, state-space methods- controllability and observability, pole placement controllers, design of observers (estimators) - full-order prediction, reduced-order, and current observers, system identification, optimal control- linear quadratic regulator (LQR), linear quadratic Gaussian (LQG) estimator (Kalman filter), implementation of controllers, and laboratory experiments for validation of analysis and design techniques on real laboratory scale hardware modules. Both single-input single-output (SISO) and multi-input multi-output (MIMO) systems are covered. Software platform of MATLAB/Simlink is used for analysis, design, and simulation and hardware/software platforms of National Instruments (NI)/LabVIEW are used for implementation and validation of analysis and design of digital control systems. Demonstrating the use of an integrated approach to cover interdisciplinary topics of digital control, emphasizing theoretical background, validation through analysis, simulation, and implementation in physical laboratory experiments, the book is ideal for students of engineering and applied science across in a range of concentrations.
I am excited to share my new book "Introduction to Mechatronics - An Integrated Approach, Springer, 2023" available through https://link.springer.com/book/10.1007/978-3-031-29320-7.
This textbook presents mechatronics through an integrated approach covering instrumentation, circuits and electronics, computer-based data acquisition and analysis, analog and digital signal processing, sensors, actuators, digital logic circuits, microcontroller programming and interfacing. The use of computer programming is emphasized throughout the text, and includes MATLAB for system modeling, simulation, and analysis; LabVIEW for data acquisition and signal processing; and C++ for Arduino-based microcontroller programming and interfacing. The book provides numerous examples along with appropriate program codes, for simulation and analysis, that are discussed in detail to illustrate the concepts covered in each section. The book also includes the illustration of theoretical concepts through the virtual simulation platform Tinkercad to provide students virtual lab experience.
Kevin
Kevin
上次活动时间: 2025-1-14

I had originally planned on publishing my book via a traditional publisher, but am now reconsidering whether to use Amazon.com. I use Matlab and Latex in my book. It appears that it is not possible to publish is with Amazon due to this. Advice? Thanks. Kevin Passino