MathWorks | Guy on Simulink
393 FOLLOWERS
Guy Rouleau is an Application Engineer for MathWorks. He writes here about Simulink and other MathWorks tools used in Model-Based Design.
MathWorks | Guy on Simulink
3w ago
Let's continue our tour of the most viewed Simulink-related MATLAB Answers. This week, we look at:How to correct error in port width or dimension in simulink ?While this error mentions dimensions,... read more >> ..read more
MathWorks | Guy on Simulink
1M ago
Looking at the Release Notes for Simulink in R2024b, what stands out the most to me is that we have improved a lot of already existing features. Let's look at my favorites of those enhancements.New... read more >> ..read more
MathWorks | Guy on Simulink
1M ago
Here is another frequently visited page on MATLAB Answers:How can I create an impulse (delta) signal in Simulink?The ProblemLet's first look at what Wikipedia has to say about the Dirac delta... read more >> ..read more
MathWorks | Guy on Simulink
2M ago
In 2016, we published this blog post simulating a pole vault jump. I decided to revisit this topic and demonstrate how I would simulate this using the latest features in Simulink.Pole Vault ModelHere... read more >> ..read more
MathWorks | Guy on Simulink
2M ago
With the Paris Olympics going on, I decided to revisit the simulation of the shot put event that we published in 2016. BackgroundI recommend visiting the 2016 blog post for more background on how we... read more >> ..read more
MathWorks | Guy on Simulink
2M ago
Let's look at another frequently visited MATLAB Answers page:
Derivative of state '1' in block 'X/Y/Integrator' at time 0.55 is not finite.
The Problem
Here is a simple model similar to the one I have been using recently in multiple posts.
mdl = "suspension";
open_system(mdl);
When simulating the model, we get the same error as reported in MATLAB Answers:
in = Simulink.SimulationInput(mdl);
in = in.setModelParameter('Stoptime','500');
in = in.setModelParameter('CaptureErrors','on');
out= sim(in);
out.ErrorMessage
ans = 'Derivative of state 'dx' in block 'suspension/Integrator, Second-Or ..read more
MathWorks | Guy on Simulink
3M ago
I recently ran into a report of the most visited entries on MATLAB Answers. I looked at the ones involving Simulink and thought it would be interesting to cover some of those on this blog.
While most questions have direct answers, I think this is a good opportunity to provide additional background and cover some subtleties not addressed on MATLAB Answers.
This week, I am starting with the most visited:
how to run simulink simulation from matlab script
Before giving you my answer to this question, I want to encourage you to visit the documentation page Run Simulations Programmatically. It c ..read more
MathWorks | Guy on Simulink
6M ago
MATLAB R2024a is now available, and a lot of new important features have been added to Simulink. Here are my top 5.
Simulation object
Using the Simulation object, you can programmatically run a simulation step by step. You can execute the simulation one step at a time, for a specified number of steps or up to a specific time. Here is an example where I simulate the model up to t=18.5 seconds, then I change the value of variable k and continue the simulation until the stop time:
mdl = 'vdpX';
sm = simulation(mdl);
% Run the first part of the simulation with k=0.2
sm.setVariable('k',0.2);
step ..read more
MathWorks | Guy on Simulink
6M ago
MATLAB R2024a has been released recently, so I thought I should share my favorite new addition to Simulink: The ability to add emojis everywhere!
As you probably know, it has been possible for many releases now to include emojis in the comments of MATLAB code:
It is now possible to use emojis in Simulink too!
Including Emojis in blocks and signal names
When you are editing the name of a block or an annotation, try hitting the shortcut "Win+." (or Cmd-Ctrl-Space for Mac OS) to launch the emoji dialog:
Those will not only show up in the editor canvas, they will follow along through your entir ..read more
MathWorks | Guy on Simulink
7M ago
On this π day 2024, I decided to tag along with Mike Croucher from The MATLAB Blog and show one way to compute π.
While Mike went for advanced maneuvers involving the MATLAB AI Chat Playground, Parallel Computing Toolbox, and even Quantum Computing, I decided to go with the way our ancestors would have done thousands of years ago: by rolling a cylinder. See method 1 in this WikiHow article for more details.
The Model
Using Simscape Multibody, I connected a Planar Joint and a Cylinder Solid together. I let the Cylinder fall on an Infinite Plane and used the Spatial Contact Force block to compu ..read more