Monday, April 29, 2024
HomeMatlabWeblog Submit Quantity 300, Vibrating Brand » Cleve’s Nook: Cleve Moler on...

Weblog Submit Quantity 300, Vibrating Brand » Cleve’s Nook: Cleve Moler on Arithmetic and Computing


That is put up quantity 300 of Cleve’s Nook weblog. The primary put up was on June 6, 2012, which is 600 weeks in the past. So, I’ve averaged one put up each two weeks for over a decade. The posts have been extra frequent within the early days and are much less frequent immediately.

Contents

Vibrating Brand

For my 300-th put up, I wish to take one other take a look at our MathWorks emblem. Here’s a modified model of one of many animations that I entered within the latest MATLAB Flipbook Mini Hack.

       Vibrating Brand

The MathWorks firm emblem is the answer to a partial differential equation that describes how a disturbance travels by way of matter. I mentioned the emblem in a five-part weblog put up in 2014. Listed below are hyperlinks to a few of these posts.

Why is it L-shaped?.

The strategy of explicit options.

How the view has developed..

Considered one of my most-liked weblog posts is by ten-year outdated Eden Rajapakse.

Code

This code is on the market at vibrating_logo.

vibrating_logo

operate vibrating_logo
    
    
    

    cease = init_fig;
    fps = 6;
    f = 0;
    
    whereas true
        f = f + 1;
        if cease.Worth
            return
        finish
        vibrating_logo_frame(f)
        pause(1/fps)
    finish

vibrating_logo_frame

    operate vibrating_logo_frame(f)
        
        
        if f == 1
            first_frame
        finish
        fud = get(gcf,'UserData');
        [mu,L,s] = deal(fud{:});
        t = (f-1)/fps;
        Z = cos(mu(1)*t)*L{1} + sin(mu(2)*t)*L{2} + sin(mu(3)*t)*L{3} +  ...
            sin(mu(4)*t)*L{4} + sin(mu(5)*t)*L{5} + sin(mu(6)*t)*L{6};
        s.ZData = Z;
    finish

first body

    operate first_frame
        cla
        axis off

        
        mu = sqrt([9.6397238445, 15.19725192, 2*pi^2, ...
                   29.5214811, 31.9126360, 41.4745099]);

        
        L{1} = 30*membrane(1,25);
        L{2} = 2*membrane(2,25);
        L{3} = -2*membrane(3,25);
        L{4} = 5*membrane(4,25);
        L{5} = -3*membrane(5,25);
        L{6} = 4*membrane(6,25);

        
        axes('CameraPosition', [-193.4013 -265.1546  220.4819],...
             'CameraTarget',[26 26 10], ...
             'CameraUpVector',[0 0 1], ...
             'CameraViewAngle',9.5, ...
             'DataAspectRatio', [1 1 .9],...
             'Seen','off', ...
             'XLim',[1 51], ...
             'YLim',[1 51], ...
             'ZLim',[-13 40]);
        s = floor(zeros(dimension(L{1})), ...
             'EdgeColor','none', ...
             'FaceColor',[0.9 0.2 0.2], ...
             'FaceLighting','phong', ...
             'AmbientStrength',0.3, ...
             'DiffuseStrength',0.6, ...
             'Clipping','off',...
             'BackFaceLighting','lit', ...
             'SpecularStrength',1.0, ...
             'SpecularColorReflectance',1, ...
             'SpecularExponent',7);
        mild('Place',[40 100 20], ...
             'Model','native', ...
             'Coloration',[0 0.8 0.8]);
        mild('Place',[.5 -1 .4], ...
             'Coloration',[0.8 0.8 0]);
        set(gcf,'UserData',{mu,L,s})
    finish

init_fig

    operate cease = init_fig
        
        fig = gcf;
        fig.Coloration = 'ok';
        fig.MenuBar = 'none';
        fig.ToolBar = 'none';
        fig.NumberTitle = 'off';
        fig.Clipping = 'off';
        cease = uicontrol;
        cease.Model = 'togglebutton';
        cease.String = 'X';
        cease.FontSize = 12;
        cease.FontWeight = 'daring';
        cease.Items = 'normalized';
        cease.Place = [.92 .92 .06 .06];
        cla
        shg
    finish
finish

Printed with MATLAB® R2023a



RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments