{"id":10855,"date":"2023-12-13T13:23:26","date_gmt":"2023-12-13T18:23:26","guid":{"rendered":"https:\/\/blogs.mathworks.com\/cleve\/?p=10855"},"modified":"2023-12-15T12:10:09","modified_gmt":"2023-12-15T17:10:09","slug":"blog-post-number-300-vibrating-logo","status":"publish","type":"post","link":"https:\/\/blogs.mathworks.com\/cleve\/2023\/12\/13\/blog-post-number-300-vibrating-logo\/","title":{"rendered":"Blog Post Number 300, Vibrating Logo"},"content":{"rendered":"\r\n<div class=\"content\"><!--introduction--><p>This is post number 300 of <i>Cleve's Corner<\/i> blog. The first post was on June 6, 2012, which is 600 weeks ago. So, I have averaged one post every two weeks for over a decade. The posts were more frequent in the early days and are less frequent today.<\/p><!--\/introduction--><h3>Contents<\/h3><div><ul><li><a href=\"#c9915277-434f-44d4-99de-6fff4f66dac8\">Vibrating Logo<\/a><\/li><li><a href=\"#6055249e-059e-4e9d-841d-7b33cb86cedf\">Code<\/a><\/li><li><a href=\"#0af0eb08-aeef-4d01-96e8-3c5a5c9fd49c\">vibrating_L<\/a><\/li><li><a href=\"#7b033ed9-34d9-4309-94b5-dd5f392bb17e\">vibrating_logo_frame<\/a><\/li><li><a href=\"#884a806f-3921-4cae-997a-89f26b84ff93\">first frame<\/a><\/li><li><a href=\"#f39d9ab9-51e0-4c92-83ee-d6dd565c25f8\">init_fig<\/a><\/li><\/ul><\/div><h4>Vibrating Logo<a name=\"c9915277-434f-44d4-99de-6fff4f66dac8\"><\/a><\/h4><p>For my 300-th post, I want to take another look at our MathWorks logo. Here is a modified version of one of the animations that I entered in the recent <a href=\"https:\/\/www.mathworks.com\/matlabcentral\/communitycontests\/contests\/6\/entries\">MATLAB Flipbook Mini Hack<\/a>.<\/p><p><img decoding=\"async\" vspace=\"5\" hspace=\"5\" src=\"http:\/\/blogs.mathworks.com\/cleve\/files\/vibrating_logo.gif\" alt=\"\"> <\/p><pre>       Vibrating Logo<\/pre><p>The MathWorks company logo is the solution to a partial differential equation that describes how a disturbance travels through matter.  I discussed the logo in a five-part blog post in 2014. Here are links to three of those posts.<\/p><p><a href=\"https:\/\/blogs.mathworks.com\/cleve\/2014\/10\/13\/mathworks-logo-part-one-why-is-it-l-shaped\/\">Why is it L-shaped?<\/a>.<\/p><p><a href=\"https:\/\/blogs.mathworks.com\/cleve\/2014\/11\/17\/mathworks-logo-part-four-method-of-particular-solutions-generates-the-logo\/\">The method of particular solutions<\/a>.<\/p><p><a href=\"https:\/\/blogs.mathworks.com\/cleve\/2014\/12\/01\/mathworks-logo-part-five-evolution-of-the-logo\/\">How the view has evolved.<\/a>.<\/p><p>One of my most-liked blog posts is by ten-year old <a href=\"https:\/\/blogs.mathworks.com\/cleve\/2021\/12\/23\/a-new-view-of-our-logo\/\">Eden Rajapakse<\/a>.<\/p><h4>Code<a name=\"6055249e-059e-4e9d-841d-7b33cb86cedf\"><\/a><\/h4><p>This code is available at <a href=\"https:\/\/blogs.mathworks.com\/cleve\/files\/vibrating_L.m\">vibrating_L<\/a>.<\/p><h4>vibrating_L<a name=\"0af0eb08-aeef-4d01-96e8-3c5a5c9fd49c\"><\/a><\/h4><pre class=\"codeinput\"><span class=\"keyword\">function<\/span> vibrating_L\r\n<\/pre><pre class=\"codeinput\">    <span class=\"comment\">% MathWorks logo, vibrating L-shaped membrane. See Cleve's Corner, Dec.13, 2023.<\/span>\r\n    <span class=\"comment\">% https:\/\/blogs.mathworks.com\/cleve\/2023\/12\/13\/blog-post-nuber-300-vibrating-logo.<\/span>\r\n\r\n    stop = init_fig;\r\n    fps = 6;\r\n    f = 0;\r\n    <span class=\"comment\">% Loop until stop is toggled.<\/span>\r\n    <span class=\"keyword\">while<\/span> stop.Value == 0\r\n        f = f + 1;\r\n        vibrating_logo_frame(f)\r\n        pause(1\/fps)\r\n    <span class=\"keyword\">end<\/span>\r\n<\/pre> <h4>vibrating_logo_frame<a name=\"7b033ed9-34d9-4309-94b5-dd5f392bb17e\"><\/a><\/h4><pre class=\"codeinput\">    <span class=\"keyword\">function<\/span> vibrating_logo_frame(f)\r\n        <span class=\"comment\">%<\/span>\r\n        <span class=\"comment\">% One frame of animation.<\/span>\r\n        <span class=\"keyword\">if<\/span> f == 1\r\n            first_frame\r\n        <span class=\"keyword\">end<\/span>\r\n        fud = get(gcf,<span class=\"string\">'UserData'<\/span>);\r\n        [mu,L,s] = deal(fud{:});\r\n        t = (f-1)\/fps;\r\n        Z = cos(mu(1)*t)*L{1} + sin(mu(2)*t)*L{2} + sin(mu(3)*t)*L{3} +  <span class=\"keyword\">...<\/span>\r\n            sin(mu(4)*t)*L{4} + sin(mu(5)*t)*L{5} + sin(mu(6)*t)*L{6};\r\n        s.ZData = Z;\r\n    <span class=\"keyword\">end<\/span>\r\n<\/pre><h4>first frame<a name=\"884a806f-3921-4cae-997a-89f26b84ff93\"><\/a><\/h4><pre class=\"codeinput\">    <span class=\"keyword\">function<\/span> first_frame\r\n        cla\r\n        axis <span class=\"string\">off<\/span>\r\n\r\n        <span class=\"comment\">% First six eigenvalues.<\/span>\r\n        mu = sqrt([9.6397238445, 15.19725192, 2*pi^2, <span class=\"keyword\">...<\/span>\r\n                   29.5214811, 31.9126360, 41.4745099]);\r\n\r\n        <span class=\"comment\">% First six eigenfunctions.<\/span>\r\n        L{1} = 30*membrane(1,25);\r\n        L{2} = 2*membrane(2,25);\r\n        L{3} = -2*membrane(3,25);\r\n        L{4} = 5*membrane(4,25);\r\n        L{5} = -3*membrane(5,25);\r\n        L{6} = 4*membrane(6,25);\r\n\r\n        <span class=\"comment\">% Surf plot with custom lighting.<\/span>\r\n        axes(<span class=\"string\">'CameraPosition'<\/span>, [-193.4013 -265.1546  220.4819],<span class=\"keyword\">...<\/span>\r\n             <span class=\"string\">'CameraTarget'<\/span>,[26 26 10], <span class=\"keyword\">...<\/span>\r\n             <span class=\"string\">'CameraUpVector'<\/span>,[0 0 1], <span class=\"keyword\">...<\/span>\r\n             <span class=\"string\">'CameraViewAngle'<\/span>,9.5, <span class=\"keyword\">...<\/span>\r\n             <span class=\"string\">'DataAspectRatio'<\/span>, [1 1 .9],<span class=\"keyword\">...<\/span>\r\n             <span class=\"string\">'Visible'<\/span>,<span class=\"string\">'off'<\/span>, <span class=\"keyword\">...<\/span>\r\n             <span class=\"string\">'XLim'<\/span>,[1 51], <span class=\"keyword\">...<\/span>\r\n             <span class=\"string\">'YLim'<\/span>,[1 51], <span class=\"keyword\">...<\/span>\r\n             <span class=\"string\">'ZLim'<\/span>,[-13 40]);\r\n        s = surface(zeros(size(L{1})), <span class=\"keyword\">...<\/span>\r\n             <span class=\"string\">'EdgeColor'<\/span>,<span class=\"string\">'none'<\/span>, <span class=\"keyword\">...<\/span>\r\n             <span class=\"string\">'FaceColor'<\/span>,[0.9 0.2 0.2], <span class=\"keyword\">...<\/span>\r\n             <span class=\"string\">'FaceLighting'<\/span>,<span class=\"string\">'phong'<\/span>, <span class=\"keyword\">...<\/span>\r\n             <span class=\"string\">'AmbientStrength'<\/span>,0.3, <span class=\"keyword\">...<\/span>\r\n             <span class=\"string\">'DiffuseStrength'<\/span>,0.6, <span class=\"keyword\">...<\/span>\r\n             <span class=\"string\">'Clipping'<\/span>,<span class=\"string\">'off'<\/span>,<span class=\"keyword\">...<\/span>\r\n             <span class=\"string\">'BackFaceLighting'<\/span>,<span class=\"string\">'lit'<\/span>, <span class=\"keyword\">...<\/span>\r\n             <span class=\"string\">'SpecularStrength'<\/span>,1.0, <span class=\"keyword\">...<\/span>\r\n             <span class=\"string\">'SpecularColorReflectance'<\/span>,1, <span class=\"keyword\">...<\/span>\r\n             <span class=\"string\">'SpecularExponent'<\/span>,7);\r\n        light(<span class=\"string\">'Position'<\/span>,[40 100 20], <span class=\"keyword\">...<\/span>\r\n             <span class=\"string\">'Style'<\/span>,<span class=\"string\">'local'<\/span>, <span class=\"keyword\">...<\/span>\r\n             <span class=\"string\">'Color'<\/span>,[0 0.8 0.8]);\r\n        light(<span class=\"string\">'Position'<\/span>,[.5 -1 .4], <span class=\"keyword\">...<\/span>\r\n             <span class=\"string\">'Color'<\/span>,[0.8 0.8 0]);\r\n        set(gcf,<span class=\"string\">'UserData'<\/span>,{mu,L,s})\r\n    <span class=\"keyword\">end<\/span>\r\n<\/pre><h4>init_fig<a name=\"f39d9ab9-51e0-4c92-83ee-d6dd565c25f8\"><\/a><\/h4><pre class=\"codeinput\">    <span class=\"keyword\">function<\/span> stop = init_fig\r\n        <span class=\"comment\">% Initialize figure.<\/span>\r\n        fig = gcf;\r\n        fig.Color = <span class=\"string\">'k'<\/span>;\r\n        fig.MenuBar = <span class=\"string\">'none'<\/span>;\r\n        fig.ToolBar = <span class=\"string\">'none'<\/span>;\r\n        fig.NumberTitle = <span class=\"string\">'off'<\/span>;\r\n        fig.Clipping = <span class=\"string\">'off'<\/span>;\r\n        stop = uicontrol;\r\n        stop.Style = <span class=\"string\">'togglebutton'<\/span>;\r\n        stop.String = <span class=\"string\">'X'<\/span>;\r\n        stop.FontSize = 12;\r\n        stop.FontWeight = <span class=\"string\">'bold'<\/span>;\r\n        stop.Units = <span class=\"string\">'normalized'<\/span>;\r\n        stop.Position = [.92 .92 .06 .06];\r\n        cla\r\n        shg\r\n    <span class=\"keyword\">end<\/span>\r\n<\/pre><pre class=\"codeinput\"><span class=\"keyword\">end<\/span>\r\n<\/pre><script language=\"JavaScript\"> <!-- \r\n    function grabCode_40aeb0781f5c4e25afe65063164aff6a() {\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='40aeb0781f5c4e25afe65063164aff6a ' + '##### ' + 'SOURCE BEGIN' + ' #####';\r\n        t2='##### ' + 'SOURCE END' + ' #####' + ' 40aeb0781f5c4e25afe65063164aff6a';\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 2023 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_40aeb0781f5c4e25afe65063164aff6a()\"><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; R2023a<br><\/p><\/div><!--\r\n40aeb0781f5c4e25afe65063164aff6a ##### SOURCE BEGIN #####\r\n%% Blog Post Number 300, Vibrating Logo\r\n% This is post number 300 of _Cleve's Corner_ blog.\r\n% The first post was on June 6, 2012, which is 600 weeks ago.\r\n% So, I have averaged one post every two weeks for over a decade.\r\n% The posts were more frequent in the early days and are less frequent\r\n% today.\r\n\r\n%% Vibrating Logo \r\n% For my 300-th post, I want to take another look at our MathWorks logo.\r\n% Here is a modified version of one of the animations that I entered in\r\n% the recent \r\n% <https:\/\/www.mathworks.com\/matlabcentral\/communitycontests\/contests\/6\/entries\r\n% MATLAB Flipbook Mini Hack>.  \r\n%\r\n% <<vibrating_logo.gif>>\r\n%\r\n%         Vibrating Logo\r\n%\r\n\r\n%%\r\n% The MathWorks company logo is the solution to a \r\n% partial differential equation that describes how a disturbance travels\r\n% through matter.  I discussed the logo in a five-part blog post in 2014.\r\n% Here are links to three of those posts.\r\n%\r\n% <https:\/\/blogs.mathworks.com\/cleve\/2014\/10\/13\/mathworks-logo-part-one-why-is-it-l-shaped\/\r\n% Why is it L-shaped?>.\r\n%\r\n% <https:\/\/blogs.mathworks.com\/cleve\/2014\/11\/17\/mathworks-logo-part-four-method-of-particular-solutions-generates-the-logo\/\r\n% The method of particular solutions>.\r\n%\r\n% <https:\/\/blogs.mathworks.com\/cleve\/2014\/12\/01\/mathworks-logo-part-five-evolution-of-the-logo\/\r\n% How the view has evolved.>.\r\n%\r\n% One of my most-liked blog posts is by ten-year old\r\n% <https:\/\/blogs.mathworks.com\/cleve\/2021\/12\/23\/a-new-view-of-our-logo\/\r\n% Eden Rajapakse>.\r\n\r\n%% Code\r\n% This code is available at \r\n% <https:\/\/blogs.mathworks.com\/cleve\/files\/vibrating_L.m\r\n% vibrating_L>.\r\n\r\n%% vibrating_L\r\n\r\nfunction vibrating_L\r\n    % MathWorks logo, vibrating L-shaped membrane. See Cleve's Corner, Dec.13, 2023.\r\n    % https:\/\/blogs.mathworks.com\/cleve\/2023\/12\/13\/blog-post-nuber-300-vibrating-logo.\r\n    \r\n    stop = init_fig;\r\n    fps = 6;\r\n    f = 0;\r\n    % Loop until stop is toggled.\r\n    while stop.Value == 0\r\n        f = f + 1;\r\n        vibrating_logo_frame(f)\r\n        pause(1\/fps)\r\n    end\r\n\r\n%% vibrating_logo_frame\r\n\r\n    function vibrating_logo_frame(f)\r\n        % \r\n        % One frame of animation.\r\n        if f == 1\r\n            first_frame\r\n        end\r\n        fud = get(gcf,'UserData');\r\n        [mu,L,s] = deal(fud{:});\r\n        t = (f-1)\/fps;\r\n        Z = cos(mu(1)*t)*L{1} + sin(mu(2)*t)*L{2} + sin(mu(3)*t)*L{3} +  ...\r\n            sin(mu(4)*t)*L{4} + sin(mu(5)*t)*L{5} + sin(mu(6)*t)*L{6};\r\n        s.ZData = Z;\r\n    end\r\n\r\n%% first frame\r\n\r\n    function first_frame\r\n        cla\r\n        axis off\r\n\r\n        % First six eigenvalues.\r\n        mu = sqrt([9.6397238445, 15.19725192, 2*pi^2, ...\r\n                   29.5214811, 31.9126360, 41.4745099]);\r\n\r\n        % First six eigenfunctions.\r\n        L{1} = 30*membrane(1,25);\r\n        L{2} = 2*membrane(2,25);\r\n        L{3} = -2*membrane(3,25);\r\n        L{4} = 5*membrane(4,25);\r\n        L{5} = -3*membrane(5,25);\r\n        L{6} = 4*membrane(6,25);\r\n\r\n        % Surf plot with custom lighting.\r\n        axes('CameraPosition', [-193.4013 -265.1546  220.4819],...\r\n             'CameraTarget',[26 26 10], ...\r\n             'CameraUpVector',[0 0 1], ...\r\n             'CameraViewAngle',9.5, ...\r\n             'DataAspectRatio', [1 1 .9],...\r\n             'Visible','off', ...\r\n             'XLim',[1 51], ...\r\n             'YLim',[1 51], ...\r\n             'ZLim',[-13 40]);\r\n        s = surface(zeros(size(L{1})), ...\r\n             'EdgeColor','none', ...\r\n             'FaceColor',[0.9 0.2 0.2], ...\r\n             'FaceLighting','phong', ...\r\n             'AmbientStrength',0.3, ...\r\n             'DiffuseStrength',0.6, ... \r\n             'Clipping','off',...\r\n             'BackFaceLighting','lit', ...\r\n             'SpecularStrength',1.0, ...\r\n             'SpecularColorReflectance',1, ...\r\n             'SpecularExponent',7);\r\n        light('Position',[40 100 20], ...\r\n             'Style','local', ...\r\n             'Color',[0 0.8 0.8]);\r\n        light('Position',[.5 -1 .4], ...\r\n             'Color',[0.8 0.8 0]);\r\n        set(gcf,'UserData',{mu,L,s})\r\n    end\r\n\r\n%% init_fig\r\n\r\n    function stop = init_fig\r\n        % Initialize figure.\r\n        fig = gcf;\r\n        fig.Color = 'k';\r\n        fig.MenuBar = 'none';\r\n        fig.ToolBar = 'none';\r\n        fig.NumberTitle = 'off';\r\n        fig.Clipping = 'off';\r\n        stop = uicontrol;\r\n        stop.Style = 'togglebutton';\r\n        stop.String = 'X';\r\n        stop.FontSize = 12;\r\n        stop.FontWeight = 'bold';\r\n        stop.Units = 'normalized';\r\n        stop.Position = [.92 .92 .06 .06];  \r\n        cla\r\n        shg\r\n    end\r\nend\r\n##### SOURCE END ##### 40aeb0781f5c4e25afe65063164aff6a\r\n-->","protected":false},"excerpt":{"rendered":"<div class=\"overview-image\"><img decoding=\"async\"  class=\"img-responsive\" src=\"http:\/\/blogs.mathworks.com\/cleve\/files\/vibrating_logo.gif\" onError=\"this.style.display ='none';\" \/><\/div><!--introduction--><p>This is post number 300 of <i>Cleve's Corner<\/i> blog. The first post was on June 6, 2012, which is 600 weeks ago. So, I have averaged one post every two weeks for over a decade. The posts were more frequent in the early days and are less frequent today.... <a class=\"read-more\" href=\"https:\/\/blogs.mathworks.com\/cleve\/2023\/12\/13\/blog-post-number-300-vibrating-logo\/\">read more >><\/a><\/p>","protected":false},"author":78,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[32,24,13,23,4,25],"tags":[],"_links":{"self":[{"href":"https:\/\/blogs.mathworks.com\/cleve\/wp-json\/wp\/v2\/posts\/10855"}],"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=10855"}],"version-history":[{"count":6,"href":"https:\/\/blogs.mathworks.com\/cleve\/wp-json\/wp\/v2\/posts\/10855\/revisions"}],"predecessor-version":[{"id":10909,"href":"https:\/\/blogs.mathworks.com\/cleve\/wp-json\/wp\/v2\/posts\/10855\/revisions\/10909"}],"wp:attachment":[{"href":"https:\/\/blogs.mathworks.com\/cleve\/wp-json\/wp\/v2\/media?parent=10855"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blogs.mathworks.com\/cleve\/wp-json\/wp\/v2\/categories?post=10855"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blogs.mathworks.com\/cleve\/wp-json\/wp\/v2\/tags?post=10855"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}