File Exchange

image thumbnail

Four Bar Linkage Optimization in Simscape

version 1.4.0.0 (2.6 MB) by Steve Miller
Four-bar linkage lengths are optimized using MATLAB to follow a desired trajectory.

27 Downloads

Updated 18 Apr 2019

View License

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.txt file to get started.
See how to use Simscape Multibody to model a cam-follower mechanism:
https://www.mathworks.com/videos/modeling-contact-forces-in-a-cam-follower-94291.html

Learn more about multibody simulation with Simscape Multibody by watching this webinar
https://www.mathworks.com/videos/multibody-simulation-with-simmechanics-81877.html

Find other Simscape examples by searching posts for the keyword "physical modeling"
https://www.mathworks.com/matlabcentral/fileexchange/?term=%22physical+modeling%22

Learn more about MathWorks Simscape Products:
https://www.mathworks.com/physical-modeling/

Cite As

Steve Miller (2019). Four Bar Linkage Optimization in Simscape (https://www.mathworks.com/matlabcentral/fileexchange/62371-four-bar-linkage-optimization-in-simscape), MATLAB Central File Exchange. Retrieved .

Comments and Ratings (4)

John Ris

Hello Steve,
I am using the latest version of Matlab R2018b. Please send me the files! Much obliged!
My email is john.ris.1863@gmail.com
Best regards

Steve Miller

@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.

John Ris

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?

Updates

1.4.0.0

Added R2019a version.

1.3.0.0

Added R2018b version.

1.2.0.0

Added R2018a version.

1.1.0.0

Added R2017b version.

1.0.0.0

Adjusted description.

MATLAB Release Compatibility
Created with R2019a
Compatible with any release
Platform Compatibility
Windows macOS Linux

Four_Bar_Optim_R17a

Four_Bar_Optim_R17a/Optim

Four_Bar_Optim_R17a/Scripts_Data

Four_Bar_Optim_R17b

Four_Bar_Optim_R17b/Optim

Four_Bar_Optim_R17b/Scripts_Data

Four_Bar_Optim_R18a

Four_Bar_Optim_R18a/Optim

Four_Bar_Optim_R18a/Scripts_Data

Four_Bar_Optim_R18b

Four_Bar_Optim_R18b/Optim

Four_Bar_Optim_R18b/Scripts_Data

Four_Bar_Optim_R19a

Four_Bar_Optim_R19a/Optim

Four_Bar_Optim_R19a/Scripts_Data

Four_Bar_Optim_R17a

Four_Bar_Optim_R17b

Four_Bar_Optim_R18a

Four_Bar_Optim_R18b

Four_Bar_Optim_R19a

Four_Bar_Optim_R17a/html

Four_Bar_Optim_R17b/html

Four_Bar_Optim_R18a/html

Four_Bar_Optim_R18b/html

Four_Bar_Optim_R19a/html