This example shows a four-bar linkage modeled in Simscape Multibody that is optimized using MATLAB so that the tip of the linkage follows a desired trajectory.
Mechanical designers often wish to design mechanisms that will enable an end effector to follow a certain path. The lengths of the links and the position of the end effector influence the trajectory of the end effector in a complex kinematic relationship. Optimization algorithms can be used to tune those lengths to achieve the desired motion.
The process is similar to what is described in the video “Computational Design of Mechanical Characters” https://www.youtube.com/watch?v=DfznnKUwywQ
In this example, a parameter sweep is performed to see which trajectories are possible when varying a subset of the lengths. Then those lengths are tuned using MATLAB optimization algorithms until the resulting trajectory is within tolerances of the desired trajectory.
Please read the README.md file to get started.
Use the "Download from GitHub" button above to get files compatible with the latest release of MATLAB.
Use the links below to get files compatible with earlier releases of MATLAB.
For R2020b: https://github.com/mathworks/Simscape-Multibody-Four-Bar-Optim/archive/220.127.116.11.zip
For R2020a: https://github.com/mathworks/Simscape-Multibody-Four-Bar-Optim/archive/18.104.22.168.zip
For R2019b: https://github.com/mathworks/Simscape-Multibody-Four-Bar-Optim/archive/22.214.171.124.zip
For R2019a: https://github.com/mathworks/Simscape-Multibody-Four-Bar-Optim/archive/126.96.36.199.zip
For R2018b: https://github.com/mathworks/Simscape-Multibody-Four-Bar-Optim/archive/188.8.131.52.zip
For R2018a: https://github.com/mathworks/Simscape-Multibody-Four-Bar-Optim/archive/184.108.40.206.zip
For R2017b: https://github.com/mathworks/Simscape-Multibody-Four-Bar-Optim/archive/220.127.116.11.zip
For R2017a: https://github.com/mathworks/Simscape-Multibody-Four-Bar-Optim/archive/18.104.22.168.zip
See how to use Simscape Multibody to model a cam-follower mechanism:
Learn more about multibody simulation with Simscape Multibody by watching this webinar
Find other Simscape examples by searching posts for the keyword "physical modeling"
Learn more about MathWorks Simscape Products:
Steve Miller (2021). Four Bar Linkage Optimization in Simscape (https://github.com/mathworks/Simscape-Multibody-Four-Bar-Optim/releases/tag/22.214.171.124), GitHub. Retrieved .
hello priyanshu raj
can you get any way to add the desired path?
I have the same problem as you face in the early-stage, if you get something that can help me please share it with me
Your little content is very helpful for me
I need to develop a 4 bar mechanism (or any other kind of mechanism) to trace a desired path. I tried using this GUI but I don't understand how to input the desired trajectory in this code.
Please guide me through it so that I can input the desired path and get the optimum mechanism dimensions which trace that path.
Also, if you could suggest me any other, better way to do this, it will be very helpful.
I am using the latest version of Matlab R2018b. Please send me the files! Much obliged!
My email is firstname.lastname@example.org
@John - which MATLAB release are you using? Let me know and I may be able to send you the files tested and saved in the release you are using.
Hello! It doesn't work on my PC! I have the next error:
Output argument "options" (and maybe others) not assigned during call to "optimoptions".
Error in sm_four_bar_optim_match_path (line 86)
opt = optimoptions('patternsearch','PollMethod','GSSPositiveBasis2N',...
Please, tell me! What should I do to fix it?
Find the treasures in MATLAB Central and discover how the community can help you!Start Hunting!