Bienvenue, prenez place !
Discussions est votre espace pour apprendre à connaître vos pairs, relever ensemble de plus grands défis et vous amuser en chemin.
- Vous souhaitez voir les dernières mises à jour ? Suivez les Highlights !
- Vous recherchez des techniques pour améliorer vos compétences MATLAB ou Simulink ? Tips & Tricks est juste pour vous !
- Vous souhaitez partager la blague mathématique, le jeu de mots ou le mème parfait ? Ne cherchez pas plus loin que l՚espace Fun !
- Vous pensez qu՚il manque un canal de discussion ? Dites-nous en plus dans Ideas
Discussions mises à jour

Add a subtitle
Multi-lined titles have been supported for a long time but starting in r2020b, you can add a subtitle with its own independent properties to a plot in two easy ways.
- Use the new subtitle function: s=subtitle('mySubtitle')
- Use the new second argument to the title function: [t,s]=title('myTitle','mySubtitle')

figure() tiledlayout(2,2)
% Method 1 ax(1) = nexttile; th(1) = title('Pupil size'); sh(1) = subtitle('Happy faces');
ax(2) = nexttile; th(2) = title('Pupil size'); sh(2) = subtitle('Sad faces');
% Method 2 ax(3) = nexttile; [th(3), sh(3)] = title('Fixation duration', 'Happy faces');
ax(4) = nexttile; [th(4), sh(4)] = title('Fixation duration', 'Sad faces');
set(ax, 'xticklabel', [], 'yticklabel', [],'xlim',[0,1],'ylim',[0,1])
% Set all title colors to orange and subtitles colors to purple. set(th, 'Color', [0.84314, 0.53333, 0.1451]) set(sh, 'Color', [0, 0.27843, 0.56078])
Control title/Label alignment
Title and axis label positions can be changed via their Position, VerticalAlignment and HorizontalAlignment properties but this is usually clumsy and leads to other problems when trying to align the title or labels with an axis edge. For example, when the position units are set to 'data' and the axis limits change, the corresponding axis label will change position relative to the axis edges. If units are normalized and the axis position or size changes, the corresponding label will no longer maintain its relative position to the axis, and that's assuming the normalized position was computed correctly in the first place.
Starting in r2020b, title and axis label alignment can be set to center|left|right, relative to the axis edges.
- TitleHorizontalAlignment is a property of the axis: h.TitleHorizontalAlignment='left';
- LabelHorizontalAlignment is a property of the ruler object that defines the x | y | z axis: h.XAxis.LabelHorizontalAlignment='left';

% Create data x = randi(50,1,100)'; y = x.*[.2, -.2] + (rand(numel(x),2)-.5)*10; gray = [.65 .65 .65];
% Plot comparison between columns of y figure() tiledlayout(2,2,'TileSpacing','none') ax(1) = nexttile(1); plot(x, y(:,1), 'o', 'color', gray) lsline ylabel('Y1 (units)') title('Regression','Y1 & Y2 separately')
ax(2) = nexttile(3); plot(x, y(:,2), 'd', 'color', gray) lsline xlabel('X Label (units)') ylabel('Y2 (units)') grid(ax, 'on') linkaxes(ax, 'x')
% Move title and labels leftward set(ax, 'TitleHorizontalAlignment', 'left') set([ax.XAxis], 'LabelHorizontalAlignment', 'left') set([ax.YAxis], 'LabelHorizontalAlignment', 'left')
% Combine the two comparisons into plot and flip the second % y-axis so trend are in the same direction ax(3) = nexttile([2,1]); yyaxis('left') plot(x, y(:,1), 'o') ylim([-6,16]) lsline xlabel('X Label (units)') ylabel('Y1 (units) \rightarrow')
yyaxis('right') plot(x, y(:,2), 'd') ylim([-16,6]) lsline ylabel('\leftarrow Y2 (units)') title('Direct comparison','(Y2 axis flipped)') set(ax(3), 'YDir','Reverse')
% Align the ylabels with the minimum axis limit to emphasize the % directions of each axis. Keep the title and xlabel centered ax(3).YAxis(1).LabelHorizontalAlignment = 'left'; ax(3).YAxis(2).LabelHorizontalAlignment = 'right'; ax(3).TitleHorizontalAlignment = 'Center'; % not needed; default value. ax(3).XAxis.LabelHorizontalAlignment = 'Center'; % not needed; default value.
- Fast ramp-up in unfamiliar domains: When I explore an unfamiliar application area or a new topic, MATLAB helps me quickly locate the canonical methods and example workflows. Its comprehensive, professional documentation — along with the related-topic links typically provided at the end of each page — makes it easy to get started intuitively and saves a lot of time that would otherwise be spent hunting for foundational knowledge across the web.
- A relatively cutting-edge yet reliable technical path: MATLAB’s many toolboxes evolve with the field. While updates aren’t always absolutely bleeding-edge, they generally offer approaches that balance modernity and proven reliability. This reduces the risk of wasting time on obscure or unstable algorithms and helps me follow a pragmatic, well-tested technical direction.
- Strong community and technical support: When I encounter a problem I first post on forums like MATLAB Answers and thoroughly investigate the issue myself. If I find a solution, I publish it to contribute back — which deepens my own understanding and helps others. If I can’t solve it alone, experienced community members often respond within hours. As a last resort, MathWorks’ official support is available and typically conducts an in-depth investigation into specific cases to help resolve the issue.
- ......

- Real-time planetary mass estimation using (x, v) data.
- Integration into orbital mechanics simulations in MATLAB.
- Potential extensions into astrophysics and engineering models.
- Data-driven planetary modeling in MATLAB.
- Improved sensitivity in detecting small-scale variations not included in standard NASA datasets.
- NASA JPL Horizons (planetary positions & velocities)
- NASA Planetary Fact Sheet (official masses)
- GRACE / GRACE-FO Mission Data (Earth mass loss)
- How to integrate the NKTg model into MATLAB orbital simulations.
- Whether conserved quantities like NKTg1 could provide practical value beyond astronomy (e.g., physics simulations, engineering).

- Using the traditional lsqcurvefit-wrapped "Levenberg–Marquardt" algorithm:
- Using the deep-learning-wrapped "Levenberg–Marquardt" algorithm:
- I already did it successfully twice in the past for my previous groups ;
- If you take one problem specifically, Problem 60984. Mesh the icosahedron for instance, you can normally see the icon of the cover image in the top right hand corner, can't you ?
- I always manage to set cover images to my contributions (mostly in the filexchange).
- It's the question that drives us, Neo. It's the question that brought you here. You know the question, just as I did.
- What is the Matlab?
- Unfortunately, no one can be told what the Matlab is. You have to see it for yourself.
- The Matlab is everywhere. It is all around us. Even now, in this very room. You can feel it when you go to work [...]
- The first Matlab I designed was quite naturally perfect. It was a work of art. Flawless. Sublime.
- Kasuo Hardware Setup
- Select a Kasuo sensor (e.g., temperature, microphone, or motion sensor).
- Connect it to a DAQ or microcontroller board for data collection.
- Data Acquisition in MATLAB
- Use MATLAB’s Data Acquisition Toolbox to stream sensor data directly.
- Example snippet:
- Signal Processing with Simulink
- Build a Simulink model to filter noise, detect anomalies, or design control logic.
- Simulink enables real-time visualization and iterative tuning.
- Validation & Protection Simulation
- Add Kasuo’s circuit protection components (e.g., TVS diodes, surge suppressors) in the physical design.
- Use Simulink to simulate stress conditions, validating system robustness before hardware testing.
- Faster prototyping with MATLAB & Simulink.
- Greater reliability by incorporating Kasuo protection devices.
- Seamless transition from model to hardware implementation.
- matrix1, matrix2, matrix3, matrix4, ...
- test_20kmh, test_50kmh, test_80kmh, ...
- nameA, nameB, nameC, nameD,...
- Slow
- Buggy
- Security Risk
- Difficult to Work With
- Obfuscated Code Intent
- Confuses Data with Code
- Code Helper Tools do not Work
- Magically Making Variables Appear in a Workspace is Risky
- Indexing into Cell Array or ND-Array
- Non-scalar Structures (with Indexing)
- Dynamic Field-Names in a Structure
- load into a Structure, not into the Workspace
- save the Fields of a Scalar Structure
- Use a table or timetable Array
- Use more Efficient Ways to Pass Variables Between Workspaces
À propos de Discussions
Get to know your peers while sharing all the tricks you've learned, ideas you've had, or even your latest vacation photos. Discussions is where MATLAB users connect!
Plus d՚espaces communautaires
Posez ou répondez aux questions concernant MATLAB et Simulink !
Téléchargez un code soumis par un utilisateur ou proposez votre contribution !
Résolvez des groupes de problèmes, découvrez MATLAB et gagnez des badges !
Découvrez le point de vue des initiés sur MATLAB et Simulink !
Utilisez l’IA pour générer un draft initial de votre code MATLAB et répondre aux questions !