
This paper illustrates the conducted effort to introduce the methodology of optimal synthesis of mechanisms through an engineering problem under Matlab. This project is part of a first course on poly-articulated mechanisms and robotics at the graduate level. The course combines both the theoretical and implementation under Matlab aspects to achieve its goals. The example of the rowing machine is considered to introduce the crank-slider mechanism and the kinematic analysis using complex numbers. The mechanism is associated with a spring to ensure the device simulating the resistance in the rowing bench simulator. The optimal synthesis problem is formulated for the desired effort to perform and solved using the Sequential Quadratic Programming method. All developments are implemented under Matlab.
Citation: Med Amine LARIBI. Optimal synthesis of a planar mechanism using Matlab: Example of slider crank in a rowing motion[J]. STEM Education, 2023, 3(1): 1-14. doi: 10.3934/steme.2023001
[1] | Med Amine Laribi, Saïd Zeghloul . Redundancy understanding and theory for robotics teaching: Application on a human finger model. STEM Education, 2021, 1(1): 17-31. doi: 10.3934/steme.2021002 |
[2] | Lotfi Romdhane, Mohammad A. Jaradat . Interactive MATLAB based project learning in a robotics course: Challenges and achievements. STEM Education, 2021, 1(1): 32-46. doi: 10.3934/steme.2021003 |
[3] | Eduard Krylov, Sergey Devyaterikov . Developing students' cognitive skills in MMS classes. STEM Education, 2023, 3(1): 28-42. doi: 10.3934/steme.2023003 |
[4] | Inae Jeong, Tanya Evans . Knowledge Organisers for learning: Examples, non-examples and concept maps in university mathematics. STEM Education, 2023, 3(2): 103-129. doi: 10.3934/steme.2023008 |
[5] | William Guo . Solving problems involving numerical integration (I): Incorporating different techniques. STEM Education, 2023, 3(2): 130-147. doi: 10.3934/steme.2023009 |
[6] | X. Yamile Sandoval-Castro, Eduardo Castillo-Castaneda, Benigno Munoz-Barron, Maximiano F. Ruiz-Torres . Mechanical programmable design of soft pneumatic actuators with kirigami patterns to generate expanding, bending and twisting motions. STEM Education, 2023, 3(1): 15-27. doi: 10.3934/steme.2023002 |
[7] | Shuangji Yao, Yunfei Guo, Botao Yang, You Lv, Marco Ceccarelli, Xiaoshuang Dai, Giuseppe Carbone . Single-objective flexible job-shop scheduling problem based on improved dung beetle optimization. STEM Education, 2024, 4(3): 299-327. doi: 10.3934/steme.2024018 |
[8] | Aai Sheau Yean, Suzieleez Syrene Abdul Rahim, Umi Kalsum Binti Mohd Salleh . Techno-optimism of Malaysia education blueprint (2013-2025) and its effect on the local sustainability education narrative. STEM Education, 2024, 4(3): 199-221. doi: 10.3934/steme.2024013 |
[9] | Xin Zhang, Longzhu Yi, Huikuan Chen, Jiayu Qian, Xuesong Zhai . Collaborative science experiments based on the educational metaverse: Research on the impact and mechanisms of collaborative science experiments on elementary students' creative thinking. STEM Education, 2025, 5(2): 250-274. doi: 10.3934/steme.2025013 |
[10] | Xiangping Cui, Jiangming Qian, Soheila Garshasbi, Susan Zhang, Geng Sun, Juan Wang, Jun Shen, Lin Yue, Yewen Lyu . Enhancing learning effectiveness in livestream teaching: Investigating the impact of teaching, social, and cognitive presences through a community of inquiry lens. STEM Education, 2024, 4(2): 82-105. doi: 10.3934/steme.2024006 |
This paper illustrates the conducted effort to introduce the methodology of optimal synthesis of mechanisms through an engineering problem under Matlab. This project is part of a first course on poly-articulated mechanisms and robotics at the graduate level. The course combines both the theoretical and implementation under Matlab aspects to achieve its goals. The example of the rowing machine is considered to introduce the crank-slider mechanism and the kinematic analysis using complex numbers. The mechanism is associated with a spring to ensure the device simulating the resistance in the rowing bench simulator. The optimal synthesis problem is formulated for the desired effort to perform and solved using the Sequential Quadratic Programming method. All developments are implemented under Matlab.
Students, in Mechanical Engineering courses, are typically introduced to the study of machine kinematics through an introductory unit in kinematics. The fundamental physics of motion is explained as the student works through a large number of problems contained in one of the acknowledged textbooks [1]. In general, Science, Technology, Engineering, and Mathematics (STEM) education is the cross-curricular study of science, technology, engineering, and mathematics, and the application of those subjects in real-world contexts [2, 3]. As students engage in STEM education, they develop the transferable skills that they need to meet the demands of today's global economy and society, and to become scientifically and technologically literate citizens.
In addition, students will discover how the four disciplines connect as they explore mechanics, including experiments in mechanical advantage and mechanism set-ups, and may even conceptualize new lifting and transport solutions. Once they are familiar with the various types of mechanisms, they'll have the opportunity to explore innovative solutions to real-world problems, challenges, and needs [4].
A mechanism is defined as an arrangement of machine elements that produce a specified motion [5]. Four-bar mechanisms are a class of simple but practically important mechanisms [6, 7]. The slider-crank mechanism is a particular four-bar linkage configuration that converts linear motion to rotational, or vice versa [8]. Internal combustion engines are a common example of this mechanism, where combustion in a cylinder creates pressure which drives a piston. The piston's linear motion is converted into rotational motion at the crank through a mutual link, referred to as the connecting rod. As the geometry of the crank forces the conversion of linear motion to rotational, shaking forces are generated and applied to the crank's housing. These shaking forces result in vibrations which impede the operation of the engine.
The slider-crank mechanism is frequently utilized in undergraduate engineering courses to investigate machine kinematics and resulting dynamic forces. The position, velocity, acceleration and shaking forces generated by a slider-crank mechanism during operation can be determined analytically. Certain factors are often neglected from analytical calculations, causing results to differ from experimental data. The assumption is frequently made that the crankshaft's angular velocity is constant. In reality, angular velocity is slightly higher on the power stroke than on the return stroke. The study of these slight variances produces useful insight into the characteristics of piston driven engines.
The synthesis of a mechanism is the process of combining parametric elements into a mechanism that shows complex behavior [9]. Mechanism synthesis includes function generation, motion generation and path generation.
The paper is organized as follows, after the introduction in section one the rowing mechanism overview is covered in section two, the kinematic analysis using complex numbers of the slider-crank mechanism is presented in section three. The issue of the initial solution of the rowing bench and the formulation of the optimal synthesis problem are addressed in section four. Finally, the concluding remarks are summarized in section five.
The considered device is located in an apartment and simulates the movements of the rower. The operator should apply an effort on the oar of the rowing mechanism. This effort varies basis on the oar position and can be more or less important according to the training scenario:
● Pushing on the oars, direction A (see Figure 1), these being out of the water, the effort is low, just the movement of the oars.
● Traction on the oars, direction B (see Figure 1), these are in the water, the effort is significant, because the water opposes the movements of the oars.
The tractive effort can be adjusted by more or less tightening the adjustment needle 16, see the system assembly drawing in Appendix 1.
The stress simulation is related to the movement of oil inside the device. Two identical devices are located on each side of the rower.
The kinematic graph of the rowing mechanism is given by Figure 3 and is equivalent to a slider-crank mechanism. This later is a four-link mechanism with three revolute joints and one sliding joint. The rotation of the crank drives the linear movement of the slider, or the expansion of gases against a sliding piston in a cylinder can drive the rotation of the crank.
In planar mechanisms, kinematic analysis can be performed either analytically or graphically. In this work, we investigate analytical kinematic analysis [10]. Analytical kinematics is based on projecting the vector loop equation(s) of a mechanism onto the axes of a non-moving Cartesian frame. This projection transforms a vector equation into two algebraic equations. Then, for a given value of the position (or orientation) of the input link, the algebraic equations are solved for the position and/or orientation of the remaining links. The first and second time derivative of the algebraic position equations provide the velocity and acceleration equations for the mechanism. For given values of the velocity and acceleration of the input link, these equations are solved to find the velocity and acceleration of the other links in the system.
This section is focused on the kinematic analysis of the slider-crank mechanism. As a planar mechanism, the slider-crank can be represented by a general chain, consisting of one or more loops of successive bar-slider members.
Complex numbers readily lend themselves as an ideal tool for modeling linkage members as part of planar chains. For each bar-slider member, the position of the pivot on the slider with respect to the pivot of the bar can be defined by a relative position vector
Zk=Zkeiθ=Zk(cosθ+isinθ) | (1) |
where,
In a slider-crank mechanism, depending on its application, either the crank is the input link and the objective is to determine the kinematics of the connecting rod and the slider, or the slider is the input link and the objective is to determine the kinematics of the connecting rod and the crank. In the present example, we assume the first case: for the known value of
We start the analysis by defining vectors and constructing the vector loop equation using complex numbers:
OC=OA+AB+BC | (2) |
ZOC=ZOA+ZAB+ZBC | (3) |
We place the
xeiθ0=L2eiθ2−L3eiθ3+L4eiθ4 | (4) |
Position equations
The vector loop equation is projected onto the
xcosθ0=L2cosθ2−L3cosθ3+L4cosθ4 | (5) |
xsinθ0=L2sinθ2−L3sinθ3+L4sinθ4 | (6) |
Since
x=L2cosθ2−L3cosθ3+L4 | (7) |
0=L2sinθ2−L3sinθ3 | (8) |
Velocity equations
The time derivative of the position equations yields the velocity equations:
˙x=L2ω2sinθ2+L3ω3sinθ3 | (9) |
0=L2ω2cosθ2−L3ω3cosθ3 | (10) |
These equations can also be represented in matrix form, where the terms associated with the known crank velocity are moved to the right-hand-side:
[1−L2sinθ20−L2cosθ2][˙xω2]=[L3ω3sinθ3−L3ω3cosθ3] | (11) |
Acceleration equations
The time derivative of the velocity equations yields the acceleration equations:
¨x=L2˙ω2sinθ2+L2ω22cosθ2+L3˙ω3sinθ3+L3ω23cosθ3 | (12) |
0=L2˙ω2cosθ2−L2ω22sinθ2−L3˙ω3cosθ3+L3ω23sinθ3 | (13) |
These equations can also be represented in matrix form, where the terms associated with the known crank acceleration and the quadratic velocity terms are moved to the right-hand-side:
[1−L2sinθ20−L2cosθ2][¨x˙ω2]=[L3˙ω3sinθ3+L3ω33cosθ3+L2ω22cosθ2−L3˙ω3cosθ3+L3ω23sinθ3−L2ω22sinθ2] | (14) |
The relationship between the input and output variables of the mechanism can be obtained from equations (5) and (6). The slider position,
x2−2x[L2cosθ2−L4]+L22+L24−L23+2L2L4cosθ2=0 | (15) |
If we consider
x=L2cosθ2±√L22(cosθ2−1)−L23 | (16) |
The slider velocity is obtained by the time derivative of the previous equations:
˙x=−L2ω2sinθ2±L22ωsinθ2√L22(cosθ2−1)−L23 | (17) |
To obtain the evolution of the input-output equation and for given values of the design parameters
In order to visualize the evolution of the slider position and the slider velocity, two functions have been implemented under Matlab. The implementation is considered for given values of the design parameters
function [x] = position (t, L2, L3) % t : input crank angle for i=1:max(size(t)) x(i)= L2*cos(t(i))+ sqrt((L2^2*(cos(t(i))-1))-L3^2); end end |
Further, the obtained curves are based on one rotation of the crank for a rotation speed of the crank of
function [v] = velocity(L2, L3, t, dt) % dt : rotation speed of the crank in rpm % t : input crank angle dt1 = dt*pi/30; for i=1:max(size(t)) v(i)= -L2*sin(t(i))*dt*(1+L2/(sqrt((L2^2*(cos(t(i))-1))-L3^2)); end end |
Figures 4 and 5 illustrate the evolutions of the position and the velocity for one crank rotation.
The rowing bench simulator not working properly, so it was decided to replace the device simulating the resistance with pressurized air. This latter will be replaced by a mechanical solution and assimilated to a force of a spring of stiffness
The expected effort to be performed by the mechanical solution is presented in Figure 6. The effort is given for one rotation of the crank angle and for 63 positions with a step of
The objective of this section is to determine the values of the fixed parameters of the crank-slider mechanism, defining the design vector
function [F] = effort(t, L2, L3) x = position(t, L2, L3); % Crank position for i=1:max(size(t)) F(i) = 244 * x(i); end end |
The evolution of the effort
Using the squared error as the optimization criterion, one can write the general formulation of dimensional synthesis problem of the mechanism as follows:
minIf(I(x))subjectto{c(I(x))≤0xmin≤x≤xmax | (18) |
with,
To find out optimal values for the parameters
In the case of the slider crank mechanism, the optimisation problem can be defined as follow:
minIf(I)subjectto{I=[L2L3]L2<L31≤L2≤1011≤L3≤20 | (19) |
To solve the optimisation problem linked to the dimensional synthesis problem of the crank-slider mechanism an optimisation method based on a nonlinear programming solver under Matlab (Sequential Quadratic Programming) is applied [11]. In order to help visualising the optimisation, the 3D plot of the objective function will be presented in the next section.
The purpose of Sequential Quadratic Programming (SQP) is to find a set of parameters that minimize the cost function
We will use SQP to find the values of
The script computing the squared errors for all combinations of
step = 360/63; t = (0:step: 360-step); L2 = (1:0.1:10); L3 = (10:0.1:19); e = []; F = zeros(size(t)); n = 63; for i=1:max(size(L2)) for j=1:max(size(L3)) for k=1:max(size(t)) F(k) = effort(t(k), L2(i), L3(j)); end e(i, j)=(1/n)*sum((Fd-F').^2); end end figure(2) surf(L2, L3, e), xlabel('Crank length L2 (mm)'), ylabel('Connecting rod length L3 (mm)'), zlabel('Squared error'); |
The minimum error means that the effort provided by the crank-slider mechanism is the most closer to the desired effort. This mechanism is called the optimal crank-slider mechanism and is defined by the design vector
The projections of the surface of Figure 8 on specific planes allow identifying the optimal solution. Figure 9 presents the obtained projections and the approximated lengths values, which can be computed graphically.
The optimisation problem is applied to solve accurately the optimisation problem based on a nonlinear programming solver under Matlab. For sake of simplicity, the optimisation problem is solved without constraints and fminunc (Table 5) is applied to find the minimum of unconstrained multivariable function Fobj (Table 6), which represents the objective function. The desired value of the effort mentioned, as explained in section §4.1, is given by the load of file
options = optimoptions('fmincon', 'Display', 'iter', 'Algorithm', 'sqp'); lam0 = [1, 5]; [x, fval] = fminunc(@Fobj, lam0, options); |
function [e]=Fobj(I) L2=I(1); L3=I(2); k=244; x0=load('Fd'); x0=x0*1000; t=0:0.1:2*pi; x=(L2*cos(t)+sqrt(L3^2-(sin(t)*L2).^2))*k; for i=1:size(x, 2) E(i)=(x0(i)-x(i))^2; end e=sum(E)/size(x, 2); |
The optimisation starts at the point lam0 and attempts to find a minimum
The optimal solution is obtained through six iterations and defined by
![]() |
Optimal synthesis of a new mechanism to replace the existing mechanism of the rowing machine is achieved thanks to the association of a slider crank mechanism and a spring. An approach based on the kinematic analysis using complex numbers on one hand, and the optimal synthesis problem formulation on the second hand has been presented. Detailed developments have been implemented under Matlab and presented with annotated codes.
It is expected that the new machine will present resistance in the rowing bench simulator and have improved performance in terms of behavior. The desired effort to perform was considered as a problem input and handled in the optimization problem which is solved using the Sequential Quadratic Programming method.
All authors declare no conflicts of interest in this paper.
![]() |
[1] | Meriam, J.L. and Kraige, L.G., Engineering mechanics, Volume 2 Dynamics, Wiley, 1997. |
[2] |
Thibaut L., Ceuppens S., De Loof H., De Meester J., Goovaerts L., Struyf A., et al. (2018) Integrated STEM education: A systematic review of instructional practices in secondary education. European Journal of STEM Education 3: 2. ![]() |
[3] |
Ghani U., Zhai X., Ahmad R. (2021) Mathematics skills and STEM multidisciplinary literacy: Role of learning capacity. STEM Education 1: 104. ![]() |
[4] | Koleza, E. and Skordoulis, C.D., Innovating STEM Education: Increased Engagement and Best Practices. Champaign, IL: Common Ground Research Networks. https://doi.org/10.18848/978-1-86335-251-2/CGP |
[5] | Erdman, A.G. and Sandor, G.N., Mechanism Design: Analysis and Synthesis, 4th ed.; Pearson: London, UK, 2001. |
[6] |
Cabrera J., Simon A., Prado M. (2002) Optimal synthesis of mechanisms with genetic algorithms. Mech Mach Theory 37: 1165-1177. ![]() |
[7] |
Laribi M., Mlika A., Romdhane L., Zeghloul S. (2004) A combined genetic algorithm-fuzzy logic method GA-FL in mechanisms synthesis. Mech Mach Theory 39: 717-735. ![]() |
[8] | McCarthy, J.M. and Joskowicz, L., Kinematic synthesis, Cambridge University Press, 2009. |
[9] |
Hernández A., Muñoyerro A., Urízar M., Amezua E. (2021) Comprehensive approach for the dimensional synthesis of a four-bar linkage based on path assessment and reformulating the error function. Mech Mach Theory 156: 104126. ![]() |
[10] | Constans, E. and Dyer, K.B., Introduction to Mechanism Design with Computer Applications, CRC Press Taylor & Francis Group, 2019. https://doi.org/10.1201/b22145 |
[11] | Nocedal, J. and Wright, S., Numerical Optimization, Springer, 2006. |
function [x] = position (t, L2, L3) % t : input crank angle for i=1:max(size(t)) x(i)= L2*cos(t(i))+ sqrt((L2^2*(cos(t(i))-1))-L3^2); end end |
function [v] = velocity(L2, L3, t, dt) % dt : rotation speed of the crank in rpm % t : input crank angle dt1 = dt*pi/30; for i=1:max(size(t)) v(i)= -L2*sin(t(i))*dt*(1+L2/(sqrt((L2^2*(cos(t(i))-1))-L3^2)); end end |
function [F] = effort(t, L2, L3) x = position(t, L2, L3); % Crank position for i=1:max(size(t)) F(i) = 244 * x(i); end end |
step = 360/63; t = (0:step: 360-step); L2 = (1:0.1:10); L3 = (10:0.1:19); e = []; F = zeros(size(t)); n = 63; for i=1:max(size(L2)) for j=1:max(size(L3)) for k=1:max(size(t)) F(k) = effort(t(k), L2(i), L3(j)); end e(i, j)=(1/n)*sum((Fd-F').^2); end end figure(2) surf(L2, L3, e), xlabel('Crank length L2 (mm)'), ylabel('Connecting rod length L3 (mm)'), zlabel('Squared error'); |
options = optimoptions('fmincon', 'Display', 'iter', 'Algorithm', 'sqp'); lam0 = [1, 5]; [x, fval] = fminunc(@Fobj, lam0, options); |
function [e]=Fobj(I) L2=I(1); L3=I(2); k=244; x0=load('Fd'); x0=x0*1000; t=0:0.1:2*pi; x=(L2*cos(t)+sqrt(L3^2-(sin(t)*L2).^2))*k; for i=1:size(x, 2) E(i)=(x0(i)-x(i))^2; end e=sum(E)/size(x, 2); |
function [x] = position (t, L2, L3) % t : input crank angle for i=1:max(size(t)) x(i)= L2*cos(t(i))+ sqrt((L2^2*(cos(t(i))-1))-L3^2); end end |
function [v] = velocity(L2, L3, t, dt) % dt : rotation speed of the crank in rpm % t : input crank angle dt1 = dt*pi/30; for i=1:max(size(t)) v(i)= -L2*sin(t(i))*dt*(1+L2/(sqrt((L2^2*(cos(t(i))-1))-L3^2)); end end |
function [F] = effort(t, L2, L3) x = position(t, L2, L3); % Crank position for i=1:max(size(t)) F(i) = 244 * x(i); end end |
step = 360/63; t = (0:step: 360-step); L2 = (1:0.1:10); L3 = (10:0.1:19); e = []; F = zeros(size(t)); n = 63; for i=1:max(size(L2)) for j=1:max(size(L3)) for k=1:max(size(t)) F(k) = effort(t(k), L2(i), L3(j)); end e(i, j)=(1/n)*sum((Fd-F').^2); end end figure(2) surf(L2, L3, e), xlabel('Crank length L2 (mm)'), ylabel('Connecting rod length L3 (mm)'), zlabel('Squared error'); |
options = optimoptions('fmincon', 'Display', 'iter', 'Algorithm', 'sqp'); lam0 = [1, 5]; [x, fval] = fminunc(@Fobj, lam0, options); |
function [e]=Fobj(I) L2=I(1); L3=I(2); k=244; x0=load('Fd'); x0=x0*1000; t=0:0.1:2*pi; x=(L2*cos(t)+sqrt(L3^2-(sin(t)*L2).^2))*k; for i=1:size(x, 2) E(i)=(x0(i)-x(i))^2; end e=sum(E)/size(x, 2); |