{"id":5112,"date":"2019-08-26T12:00:27","date_gmt":"2019-08-26T17:00:27","guid":{"rendered":"https:\/\/blogs.mathworks.com\/cleve\/?p=5112"},"modified":"2020-08-24T16:20:52","modified_gmt":"2020-08-24T20:20:52","slug":"kuramoto-model-of-synchronized-oscillators","status":"publish","type":"post","link":"https:\/\/blogs.mathworks.com\/cleve\/2019\/08\/26\/kuramoto-model-of-synchronized-oscillators\/","title":{"rendered":"Kuramoto Model of Synchronized Oscillators"},"content":{"rendered":"<div class=\"content\"><!--introduction--><p>Fireflies on a summer evening, pacemaker cells, neurons in the brain, a flock of starlings in flight, pendulum clocks mounted on a common wall, bizarre chemical reactions, alternating currents in a power grid, oscillations in SQUIDs (superconducting quantum interference devices). These are all examples of synchronized oscillators.<\/p><p>The Kuramoto model is a nonlinear dynamic system of coupled oscillators that initially have random natural frequencies and phases. If the coupling is strong enough, the system will evolve to one with all oscillators in phase.<\/p><!--\/introduction--><h3>Contents<\/h3><div><ul><li><a href=\"#9c9c3553-9b61-4027-a9b1-e56afecdd20d\">Yoshiki Kuramoto<\/a><\/li><li><a href=\"#87bf1815-6b7c-45e4-9566-b1418b0d0137\">Kuramoto model<\/a><\/li><li><a href=\"#eb33e53b-c89a-4e94-9050-5f77214682e5\">Kuramoto app<\/a><\/li><li><a href=\"#0334fa2b-8450-4227-b75e-5a4a3c103dbb\">Animations<\/a><\/li><li><a href=\"#3eadb72b-fa61-4470-ae7b-52fbeec20f0c\">kappa = 0<\/a><\/li><li><a href=\"#082c5a52-788e-4dae-9abb-4d7d75e76dba\">kappa = 0.50<\/a><\/li><li><a href=\"#6ec63b86-624e-4c77-a6e1-a76803c7dfff\">rotate on<\/a><\/li><li><a href=\"#03b9144d-e111-4827-96be-8094e22fa753\">kappa = 0.12<\/a><\/li><li><a href=\"#053f9d1e-2196-44a1-8abc-01937cbf5816\">width = 0<\/a><\/li><li><a href=\"#23bb6093-6d0b-4fc3-b717-5bdf07704720\">One-liner<\/a><\/li><li><a href=\"#441c53c6-2783-4367-972c-3830fdfd0e31\">Software<\/a><\/li><li><a href=\"#89922c31-9446-41e0-925d-9b7c4eea5feb\">References<\/a><\/li><\/ul><\/div><h4>Yoshiki Kuramoto<a name=\"9c9c3553-9b61-4027-a9b1-e56afecdd20d\"><\/a><\/h4><p>Yoshiki Kuramoto is a Professor Emeritus of physics at Kyoto University. He was born in 1940 and published the first paper about this model in 1974.  He was quite surprised when his model turned out to abstractly describe the dynamics of so many different physical systems. Here is a <a href=\"https:\/\/www.youtube.com\/watch?v=lac4TxWyBOg\">YouTube video<\/a> made in 2015 of him reminiscing about the model.<\/p><h4>Kuramoto model<a name=\"87bf1815-6b7c-45e4-9566-b1418b0d0137\"><\/a><\/h4><p>The Kuramoto model is a system of $n$ ordinary differential equations<\/p><p>$$\\dot{\\theta_k} = \\omega_k +  \\frac{\\kappa}{n}\\sum_{j=1}^n\r\n{\\sin{(\\theta_j-\\theta_k)}}, \\ k = 1,....,n$$<\/p><p>Here $\\theta_k(t)$ is a real-valued function of $t$ describing the state of the $k$-th oscillator, $\\omega_k$ is the natural frequency of the $k$-th oscillator and the real scalar $\\kappa$ is the strength of the coupling between the oscillators.<\/p><p>When $\\kappa = 0$, the equations are linear and the oscillators are independent.<\/p><p>$$\\theta_k(t)= \\omega_k t$$<\/p><p>When $\\kappa$ is increased beyond a critical point, the nonlinear term forces the phases of all the oscillators to approach a common limit.<\/p><h4>Kuramoto app<a name=\"eb33e53b-c89a-4e94-9050-5f77214682e5\"><\/a><\/h4><p>Here is the <tt>help<\/tt> entry for my <tt>kuramoto<\/tt> program.<\/p><pre class=\"codeinput\">   help <span class=\"string\">kuramoto_<\/span>\r\n<\/pre><pre class=\"codeoutput\">  Kuramoto.  Kuramoto's model of synchronizing oscillators.\r\n  kuramoto(n) has n oscillators.  Default is n = 100.\r\n \r\n  The model is a system of n ordinary differential equations.\r\n  The k-th equation is\r\n \r\n     (d\/dt) theta_k = omega_k + kappa\/n*sum_j(sin(theta_j-theta_k))\r\n \r\n     theta_k is the phase of the k-th oscillator,\r\n     omega_k is the intrinsic frequency of the k-th oscillator,\r\n     kappa is a scalar coupling parameter.\r\n \r\n  Initially, theta is distributed uniformly in the interval [0,2*pi]\r\n  and omega is distributed uniformly in the interval [1-b,1+b]\r\n  where b is a parameter called breadth.\r\n \r\n  The angular velocities of exp(i*theta) are color coded with blues\r\n  for the fastest, yellows for the slowest, and greens in between.\r\n  The display radius of exp(i*theta) is distributed normally with\r\n  mean 1 and standard deviation w where w is a parameter called width.\r\n  This is purely for visual effect and has no influence on the dynamics.\r\n  Setting width to zero puts all the oscillators on the unit circle.\r\n \r\n  The interface allows control of n, kappa, the speed of the ode solver,\r\n  breadth and width.\r\n \r\n  An alternate display mode, called \"rotate\", is a frame of reference\r\n  rotating with angular velocity psi, the average of the thetas.\r\n  A rotating arrow has length |z| where\r\n    |z|*exp(i*psi) = 1\/n*sum_k(exp(i*theta_k)).\r\n  |z| = 0 indicates no synchronization, |z| = 1 is complete synchronization.\r\n\r\n<\/pre><h4>Animations<a name=\"0334fa2b-8450-4227-b75e-5a4a3c103dbb\"><\/a><\/h4><p>I have made five animated gifs showing the program in action. Each animation is a slight variation of the others. I hope your browser or viewer is showing them moving together. If that isn't happening, let us know in the comments what system you are using.<\/p><h4>kappa = 0<a name=\"3eadb72b-fa61-4470-ae7b-52fbeec20f0c\"><\/a><\/h4><p>Here are the default settings of the controls, including <tt>kappa = 0<\/tt>. The oscillators are each moving at their natural frequency. There is no synchronization.<\/p><p><img decoding=\"async\" vspace=\"5\" hspace=\"5\" src=\"http:\/\/blogs.mathworks.com\/cleve\/files\/kuramoto_pix_1.gif\" alt=\"\"> <\/p><h4>kappa = 0.50<a name=\"082c5a52-788e-4dae-9abb-4d7d75e76dba\"><\/a><\/h4><p>Bump the coupling parameter up to <tt>kappa = 0.50<\/tt>. This forces the oscillators to move to a common frequency. The order parameter arrow grows to its full length. Near the end of this sample the slowest yellow is trying to catch up with the others.<\/p><p><img decoding=\"async\" vspace=\"5\" hspace=\"5\" src=\"http:\/\/blogs.mathworks.com\/cleve\/files\/kuramoto_pix_2.gif\" alt=\"\"> <\/p><h4>rotate on<a name=\"6ec63b86-624e-4c77-a6e1-a76803c7dfff\"><\/a><\/h4><p>You can see this better in the rotating coordinates that I have called \"rotate\".  The blues, which are faster than the average, are moving in one direction, while the slower yellows are moving in the opposite direction.<\/p><p><img decoding=\"async\" vspace=\"5\" hspace=\"5\" src=\"http:\/\/blogs.mathworks.com\/cleve\/files\/kuramoto_pix_3.gif\" alt=\"\"> <\/p><h4>kappa = 0.12<a name=\"03b9144d-e111-4827-96be-8094e22fa753\"><\/a><\/h4><p>Turn the coupling parameter back down to 0.12. This is near the threshold value that initiates synchronization. The arrow is growing slowly, but we stop before it reaches full length.<\/p><p><img decoding=\"async\" vspace=\"5\" hspace=\"5\" src=\"http:\/\/blogs.mathworks.com\/cleve\/files\/kuramoto_pix_4.gif\" alt=\"\"> <\/p><h4>width = 0<a name=\"053f9d1e-2196-44a1-8abc-01937cbf5816\"><\/a><\/h4><p>Set the width to zero.  This is the same action as the previous animation but confined to the circle. It's harder to see what's happening.<\/p><p><img decoding=\"async\" vspace=\"5\" hspace=\"5\" src=\"http:\/\/blogs.mathworks.com\/cleve\/files\/kuramoto_pix_5.gif\" alt=\"\"> <\/p><h4>One-liner<a name=\"23bb6093-6d0b-4fc3-b717-5bdf07704720\"><\/a><\/h4><p>The code for Kuramoto's system of odes is a MATLAB&#8482; one-liner.<\/p><pre class=\"codeinput\">   <span class=\"keyword\">function<\/span> theta_dot = ode(~,theta)\r\n       theta_dot = omega + kappa\/n*sum(sin(theta-theta'))';\r\n   <span class=\"keyword\">end<\/span>\r\n<\/pre><p><tt>n<\/tt> and <tt>kappa<\/tt> are real scalars. <tt>omega<\/tt> and <tt>theta<\/tt> are real column vectors of length <tt>n<\/tt>. Singleton expansion makes <tt>theta-theta'<\/tt> into an <tt>n<\/tt> -by- <tt>n<\/tt> matrix with elements <tt>theta(j)-theta(k)<\/tt>. The sum produces a row vector and the final transpose makes the result a column vector.<\/p><h4>Software<a name=\"441c53c6-2783-4367-972c-3830fdfd0e31\"><\/a><\/h4><p>I have submitted <tt>kuramoto<\/tt> to the MATLAB Central File Exchange. <a href=\"https:\/\/www.mathworks.com\/matlabcentral\/fileexchange\/72534\">Here is the link<\/a>. I have also included it in <a href=\"https:\/\/www.mathworks.com\/matlabcentral\/fileexchange\/59085-cleve_s-laboratory\">version 4.60 of Cleve's Laboratory<\/a>.<\/p><h4>References<a name=\"89922c31-9446-41e0-925d-9b7c4eea5feb\"><\/a><\/h4><p>Wikipedia, Kuramoto model, <a href=\"https:\/\/en.wikipedia.org\/wiki\/Kuramoto_model\">https:\/\/en.wikipedia.org\/wiki\/Kuramoto_model<\/a>.<\/p><p>Dirk Brockman and Steven Strogatz, \"Ride my Kuramotocycle\", <a href=\"https:\/\/www.complexity-explorables.org\/explorables\/ride-my-kuramotocycle\">https:\/\/www.complexity-explorables.org\/explorables\/ride-my-kuramotocycle<\/a>.<\/p><script language=\"JavaScript\"> <!-- \r\n    function grabCode_f4ff613c8e3848ddbe408c2b0e0846c3() {\r\n        \/\/ Remember the title so we can use it in the new page\r\n        title = document.title;\r\n\r\n        \/\/ Break up these strings so that their presence\r\n        \/\/ in the Javascript doesn't mess up the search for\r\n        \/\/ the MATLAB code.\r\n        t1='f4ff613c8e3848ddbe408c2b0e0846c3 ' + '##### ' + 'SOURCE BEGIN' + ' #####';\r\n        t2='##### ' + 'SOURCE END' + ' #####' + ' f4ff613c8e3848ddbe408c2b0e0846c3';\r\n    \r\n        b=document.getElementsByTagName('body')[0];\r\n        i1=b.innerHTML.indexOf(t1)+t1.length;\r\n        i2=b.innerHTML.indexOf(t2);\r\n \r\n        code_string = b.innerHTML.substring(i1, i2);\r\n        code_string = code_string.replace(\/REPLACE_WITH_DASH_DASH\/g,'--');\r\n\r\n        \/\/ Use \/x3C\/g instead of the less-than character to avoid errors \r\n        \/\/ in the XML parser.\r\n        \/\/ Use '\\x26#60;' instead of '<' so that the XML parser\r\n        \/\/ doesn't go ahead and substitute the less-than character. \r\n        code_string = code_string.replace(\/\\x3C\/g, '\\x26#60;');\r\n\r\n        copyright = 'Copyright 2019 The MathWorks, Inc.';\r\n\r\n        w = window.open();\r\n        d = w.document;\r\n        d.write('<pre>\\n');\r\n        d.write(code_string);\r\n\r\n        \/\/ Add copyright line at the bottom if specified.\r\n        if (copyright.length > 0) {\r\n            d.writeln('');\r\n            d.writeln('%%');\r\n            if (copyright.length > 0) {\r\n                d.writeln('% _' + copyright + '_');\r\n            }\r\n        }\r\n\r\n        d.write('<\/pre>\\n');\r\n\r\n        d.title = title + ' (MATLAB code)';\r\n        d.close();\r\n    }   \r\n     --> <\/script><p style=\"text-align: right; font-size: xx-small; font-weight:lighter;   font-style: italic; color: gray\"><br><a href=\"javascript:grabCode_f4ff613c8e3848ddbe408c2b0e0846c3()\"><span style=\"font-size: x-small;        font-style: italic;\">Get \r\n      the MATLAB code <noscript>(requires JavaScript)<\/noscript><\/span><\/a><br><br>\r\n      Published with MATLAB&reg; R2018b<br><\/p><\/div><!--\r\nf4ff613c8e3848ddbe408c2b0e0846c3 ##### SOURCE BEGIN #####\r\n%% Kuramoto Model of Synchronized Oscillators\r\n% Fireflies on a summer evening, pacemaker cells, neurons in the brain,\r\n% a flock of starlings in flight, pendulum clocks mounted on a common wall,\r\n% bizarre chemical reactions, alternating currents in a power grid,\r\n% oscillations in SQUIDs (superconducting quantum interference devices).\r\n% These are all examples of synchronized oscillators.\r\n%\r\n% The Kuramoto model is a nonlinear dynamic system of coupled oscillators\r\n% that initially have random natural frequencies and phases.\r\n% If the coupling is strong enough,\r\n% the system will evolve to one with all oscillators in phase.\r\n\r\n%% Yoshiki Kuramoto\r\n% Yoshiki Kuramoto is a Professor Emeritus of physics at Kyoto University.\r\n% He was born in 1940 and published the first paper about this model\r\n% in 1974.  He was quite surprised when his model turned out to\r\n% abstractly describe the dynamics of so many different\r\n% physical systems.\r\n% Here is a <https:\/\/www.youtube.com\/watch?v=lac4TxWyBOg\r\n% YouTube video> made in 2015 of him reminiscing about the model.\r\n\r\n%% Kuramoto model\r\n% The Kuramoto model is a system of $n$ ordinary differential equations\r\n%\r\n% $$\\dot{\\theta_k} = \\omega_k +  \\frac{\\kappa}{n}\\sum_{j=1}^n\r\n% {\\sin{(\\theta_j-\\theta_k)}}, \\ k = 1,....,n$$ \r\n%\r\n% Here $\\theta_k(t)$ is a real-valued function of $t$ describing\r\n% the state of the $k$-th oscillator, $\\omega_k$ is the natural frequency\r\n% of the $k$-th oscillator and the real scalar $\\kappa$ is the strength\r\n% of the coupling between the oscillators.\r\n%\r\n% When $\\kappa = 0$, the equations are linear and the oscillators\r\n% are independent.\r\n%\r\n% $$\\theta_k(t)= \\omega_k t$$\r\n%\r\n% When $\\kappa$ is increased beyond a critical point, the nonlinear\r\n% term forces the phases of all the oscillators to approach\r\n% a common limit.\r\n\r\n%% Kuramoto app\r\n% Here is the |help| entry for my |kuramoto| program.\r\n\r\n   help kuramoto_\r\n\r\n%% Animations\r\n% I have made five animated gifs showing the program in action.\r\n% Each animation is a slight variation of the others.\r\n% I hope your browser or viewer is showing them moving together.\r\n% If that isn't happening, let us know in the comments what\r\n% system you are using.\r\n\r\n%% kappa = 0\r\n% Here are the default settings of the controls, including |kappa = 0|.\r\n% The oscillators are each moving at their natural frequency.\r\n% There is no synchronization.\r\n% \r\n% <<kuramoto_pix_1.gif>>\r\n%\r\n%% kappa = 0.50\r\n% Bump the coupling parameter up to |kappa = 0.50|.\r\n% This forces the oscillators to move to a common frequency.\r\n% The order parameter arrow grows to its full length.\r\n% Near the end of this sample\r\n% the slowest yellow is trying to catch up with the others.\r\n%\r\n% <<kuramoto_pix_2.gif>>\r\n\r\n%% rotate on\r\n% You can see this better in the rotating coordinates that I have\r\n% called \"rotate\".  The blues, which are faster than the average,\r\n% are moving in one direction, while the slower yellows are moving\r\n% in the opposite direction.\r\n%\r\n% <<kuramoto_pix_3.gif>>\r\n\r\n%% kappa = 0.12\r\n% Turn the coupling parameter back down to 0.12.\r\n% This is near the threshold value that initiates synchronization.\r\n% The arrow is growing slowly, but we stop before it reaches full\r\n% length.\r\n%\r\n% <<kuramoto_pix_4.gif>>\r\n\r\n%% width = 0\r\n% Set the width to zero.  This is the same action as the previous\r\n% animation but confined to the circle. It's harder to see what's\r\n% happening.\r\n%\r\n% <<kuramoto_pix_5.gif>>\r\n%\r\n\r\n%% One-liner\r\n% The code for Kuramoto's system of odes is a MATLAB(TM) one-liner.\r\n\r\n   function theta_dot = ode(~,theta)\r\n       theta_dot = omega + kappa\/n*sum(sin(theta-theta'))';\r\n   end\r\n\r\n%%\r\n% |n| and |kappa| are real scalars.\r\n% |omega| and |theta| are real column vectors of length |n|.\r\n% Singleton expansion makes |theta-theta'| into an |n| -by- |n|\r\n% matrix with elements |theta(j)-theta(k)|.\r\n% The sum produces a row vector and\r\n% the final transpose makes the result a column vector.\r\n\r\n%% Software\r\n% I have submitted |kuramoto| to the MATLAB Central File Exchange.\r\n% <https:\/\/www.mathworks.com\/matlabcentral\/fileexchange\/72534\r\n% Here is the link>. I have also included it in\r\n% <https:\/\/www.mathworks.com\/matlabcentral\/fileexchange\/59085-cleve_s-laboratory\r\n% version 4.60 of Cleve's Laboratory>.\r\n\r\n%% References\r\n%\r\n% Wikipedia, Kuramoto model, <https:\/\/en.wikipedia.org\/wiki\/Kuramoto_model>.\r\n%\r\n% Dirk Brockman and Steven Strogatz, \"Ride my Kuramotocycle\",\r\n% <https:\/\/www.complexity-explorables.org\/explorables\/ride-my-kuramotocycle>.\r\n\r\n##### SOURCE END ##### f4ff613c8e3848ddbe408c2b0e0846c3\r\n-->","protected":false},"excerpt":{"rendered":"<div class=\"overview-image\"><img src=\"https:\/\/blogs.mathworks.com\/cleve\/files\/kuramoto_png.png\" class=\"img-responsive attachment-post-thumbnail size-post-thumbnail wp-post-image\" alt=\"\" decoding=\"async\" loading=\"lazy\" \/><\/div><!--introduction--><p>Fireflies on a summer evening, pacemaker cells, neurons in the brain, a flock of starlings in flight, pendulum clocks mounted on a common wall, bizarre chemical reactions, alternating currents in a power grid, oscillations in SQUIDs (superconducting quantum interference devices). These are all examples of synchronized oscillators.... <a class=\"read-more\" href=\"https:\/\/blogs.mathworks.com\/cleve\/2019\/08\/26\/kuramoto-model-of-synchronized-oscillators\/\">read more >><\/a><\/p>","protected":false},"author":78,"featured_media":5174,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[5,4,8],"tags":[],"_links":{"self":[{"href":"https:\/\/blogs.mathworks.com\/cleve\/wp-json\/wp\/v2\/posts\/5112"}],"collection":[{"href":"https:\/\/blogs.mathworks.com\/cleve\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blogs.mathworks.com\/cleve\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blogs.mathworks.com\/cleve\/wp-json\/wp\/v2\/users\/78"}],"replies":[{"embeddable":true,"href":"https:\/\/blogs.mathworks.com\/cleve\/wp-json\/wp\/v2\/comments?post=5112"}],"version-history":[{"count":10,"href":"https:\/\/blogs.mathworks.com\/cleve\/wp-json\/wp\/v2\/posts\/5112\/revisions"}],"predecessor-version":[{"id":5186,"href":"https:\/\/blogs.mathworks.com\/cleve\/wp-json\/wp\/v2\/posts\/5112\/revisions\/5186"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/blogs.mathworks.com\/cleve\/wp-json\/wp\/v2\/media\/5174"}],"wp:attachment":[{"href":"https:\/\/blogs.mathworks.com\/cleve\/wp-json\/wp\/v2\/media?parent=5112"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blogs.mathworks.com\/cleve\/wp-json\/wp\/v2\/categories?post=5112"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blogs.mathworks.com\/cleve\/wp-json\/wp\/v2\/tags?post=5112"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}