tag:www.mathworks.com,2005:/matlabcentral/fileexchange/feedMATLAB Central File Exchangeicon.pnglogo.pngMATLAB Central - File Exchange - type:Model category:"Graphics"User-contributed code library2014-12-19T11:51:51-05:00111100tag:www.mathworks.com,2005:FileInfo/324032011-08-01T16:17:56Z2011-09-08T13:30:44ZModeling, Simulation and 3D Animation of a Simple Assembly LineA simple template that combines SimEvents, Stateflow, Simulink and Simulink 3D Animation.<p>The goal of this demo is to establish a general template for simulating and animating simple assembly lines. In this example, we have two conveyor belts that have motions perpendicular to each other. Furthermore, a package needs to be mounted onto the conveyors and transferred across them as well by three gantries.</p>
<p>Key points to keep in mind:
<br />1. The SimEvents model is used to model the environmental input to the conveyor belt system. A gated release of the packages is obtained through control from the assemly line that signals if the conveyor_x is indeed free. Furthermore, each entity is assigned a unique identification number (UID) to keep track of its flow through the statechart. </p>
<p>2. The Stateflow chart is used as a diagram to sequence the states. All concurrent motions of the various elements in the system are modeled as parallel states.</p>
<p>3. The transfers are also modeled as parallel states with timed delays to create a simple loading motion. Observe how the uid values are reset only after the sequence is done to keep the various states of the system in synchronous.</p>
<p>4. The Integration subsystem is a placeholder for modeling additional dynamics that can be incorporated by the modeler.</p>
<p>5. The Animation Logic MATLAB function has been designed to simply the animation. At any point in time, there are only two blocks possible on the assembly line. By switching on/off the transparencies of the blocks, a uniform motion of the blocks can be obtained. This is much simpler than having to create a new block dynamically using the PROTO function.</p>
<p>Questions to ponder about:
<br />1. The maximum queue capacity is 25. At what value of the velocities(forward & backward) for both the conveyors will the queue length never exceed 10?
<br />2. How does the result in (1) change if you use a uniform distribution for the time-based entity generation? </p>Simulink Dudehttp://www.mathworks.com/matlabcentral/fileexchange/authors/30904MATLAB 7.12 (R2011a)SimEventsSimulinkStateflowSimulink 3D Animationfalsetag:www.mathworks.com,2005:FileInfo/312492011-04-29T15:44:26Z2011-05-06T09:09:33ZSimEvents Entity Animation in 3DBasic infrastructure S-Function for hooking up a SimEvents model to Simulink 3D Animation<p>The demo uses one possible implementation of hooking up a SimEvents model with 3D animation using Simulink 3D Animation.</p>
<p>A simple model of an entity generation is created in SimEvents. This entity generation is sampled in time to establish synchronism between the 3D objects created dynamically inside the Simulink 3D Animation environment and the SimEvents model.</p>
<p>The attribute functions are used to randomly select the color of the balls thereby modeling two dimensional randomized events in the system (entity generation and their color in time)</p>
<p>The 3D spheres that are created on the "fly" uses the PROTO definitions of similar objects contained in the "vrmarkers.wrl" file that ships with Simulink 3D Animation.
<br />These objects can be replaced with more complex objects such as luggage, machine parts etc. Also, the velocity of the balls is the same for all to maintain homogeneity. This is a parameter that can be modified in the S-Function. </p>
<p></p>Simulink Dudehttp://www.mathworks.com/matlabcentral/fileexchange/authors/30904MATLAB 7.11 (R2010b)SimEventsSimulinkSimulink 3D Animationfalsetag:www.mathworks.com,2005:FileInfo/297992010-12-21T08:44:23Z2010-12-21T08:44:23ZColor Model from PolySpace VerificationThe tool colors Simulink Model using PolySpace code verification.<p>The tool is used to color Simulink Model using PolySpace results to show directly which blocks contains or not run-time errors (like division by zero, overflow...).
<br />There are 4 colors:
<br />-green: free of run-time error
<br />-red: systematic run-time error
<br />-gray: unreachable code
<br />-orange: unproven code (potential error)
</p>David Jaffryhttp://www.mathworks.com/matlabcentral/fileexchange/authors/33512MATLAB 7.7 (R2008b)Polyspace Client for C/C++Polyspace Model Link SLEmbedded CoderSimulinkfalsetag:www.mathworks.com,2005:FileInfo/284512010-08-11T14:39:42Z2010-10-08T15:10:22ZSolution of Differential Equations with MATLAB & Simulink: Lorenz Attractor Case StudySimulink design pattern for solving differential equations, visualize results in MATLAB graphics<p>One of the readers who attended the introductory Simulink webinar:</p>
<p><a href="http://www.mathworks.com/company/events/webinars/wbnr37271.html">http://www.mathworks.com/company/events/webinars/wbnr37271.html</a></p>
<p>asked me how to implement differential equations in Simulink and visualize the results in a MATLAB plot. This demo attempts to answer those kinds of questions.</p>
<p>Notes on this submission:</p>
<p>1. The approach is to represent the equations using Simulink blocks and then use MATLAB graphics to plot the results. The advantage of using the graphical approach is with the ability to customize the solver configurations and step through the solution in time. </p>
<p>2. The design pattern shows a two stage model in which the integrator plays the role of integrating the ODE. The terms are collected and fed into this integrator. </p>
<p>3. As mentioned in the webinar, we use vector processing capabilities of the integrator to process the three terms simultaneously.</p>
<p>4. The concept of feedback is important as the solver solves for the next step in the simulation based on its current states. </p>
<p>5. We use MATLAB S-Functions to incorporate visualization code for the MATLAB GUI. Also, observe that we move the camera around so that you get a good visual of how the 3D curve looks like. There is also a model that uses a Level-1 S-function for those who may be interested in it for legacy reasons.</p>
<p>6. Look into the MATLAB S-Function code as to how a red marker that acts like a tracer is created.</p>
<p>7. The S-Function block was modeled as a discrete block with a sampling time so that a high fidelity plot could be obtained(at the cost of performance). There is a performance trade-off that you should look out for when visualizing results.</p>
<p>8. Look into the code for the various S-Functions and read the comments to understand how the code is structured.</p>
<p>9. Notes on the Lorenz Attractor: </p>
<p>The study of strange attractors began with the publication by E. N. Lorenz- "Deterministic non-periodic flow"(Journal of Atmospheric Science, 20:130-141, 1963). In the process of investigating meteorological models, Edward Lorenz found that very small truncation or rounding errors in his algorithms produced large changes in the resulting predictions. This led to the study of "strange" or chaotic attractors. </p>
<p>One crude way to visualize attractors is a set such that if during the evolution of the dynamics of the system, one of the states hits a point in that set, it will continue to remain in that set. From a simulation point of view, it is interesting to see the existence of such sets for certain nonlinear dynamical systems. If this attractor is chaotic meaning it has sensitive dependence on initial conditions, then it is called a strange attractor. </p>
<p>It was particularly an interesting result which he observed that for parameter values sigma=10, beta=8/3, and rho=28, the solutions start revolving about two repelling equilibirum points at (sqrt(72), sqrt(72.27).</p>
<p>The number of times the solution revolves around one equilibirum point before switching to the other has no discernible pattern. More information on this can be obtained in a standard introductory nonlinear systems text.</p>
<p>10. Questions to ponder about:</p>
<p>a. How would you project this 3D trajectory onto a arbitrary plane surface and visualize it during the simulation? Would the trajectory intersect itself?</p>
<p>b. How would you visualize the Poincare map?</p>
<p>c. How would you compute the number of turns the red marker makes around the equilibrium point before switching to the other? Could this number be used to generate random numbers?
<br /> </p>
<p></p>Simulink Dudehttp://www.mathworks.com/matlabcentral/fileexchange/authors/30904MATLAB 7.10 (R2010a)Simulinkfalsetag:www.mathworks.com,2005:FileInfo/208792008-07-28T15:31:47Z2009-07-07T16:42:42ZHistogram Overlay BlockThe Histogram Overlay Block plots a histogram onto your video in SimulinkĀ®<p>The Histogram Overlay block adds a histogram overlay onto your video stream. It will operate with both grayscale and RGB images as well as varying data types. It also allows you to specify the frame color to help make the plot more visible.</p>
<p>You can add this block to the Video and Image Processing Blocksetā¢ library so that it is available with other Text and Graphics blocks.</p>Alan Hwanghttp://www.mathworks.com/matlabcentral/fileexchange/authors/31143MATLAB 7.6 (R2008a)Image Processing ToolboxDSP System ToolboxSignal Processing ToolboxSimulinkComputer Vision System Toolboxfalsetag:www.mathworks.com,2005:FileInfo/179532007-12-10T15:09:36Z2009-07-06T18:02:49ZwordreportA Word report generator (ActiveX-based) in an object-oriented way<p>WORDREPORT creates or opens an existing Microsoft Office Word report and provides helper functions to add some content: text, figures, Simulink models, Stateflow charts and much more. It also helps in adding or updating the table of contents, in setting page numbering or in finding text. Actually, it is possible to mimic almost everything you can do manually. Just record a macro in Word and analyze the generated VBA code to find out how to use the ActiveX technology.</p>
<p>Example: create a new document called 'Foo.doc' and add some content (headings, figures, page breaks, page numbers, table of contents)</p>
<p>reportFilename = fullfile(pwd,'foo.doc');
<br />wr = wordreport(reportFilename);
<br />%---
<br />wr.setstyle('Heading 1');
<br />wr.addtext('TOC', [1 1]); line break before and after text
<br />wr.createtoc(1, 3);
<br />wr.addpagebreak();
<br />%---
<br />wr.setstyle('Heading 1');
<br />wr.addtext('MATLAB data', [1 1]); line break before and after text
<br />%---
<br />wr.setstyle('Heading 2');
<br />wr.addtext('Sample table', [0 1]); line break after text
<br />dataCell = { ...
<br /> 'Test 1', num2str(0.3) , 'OK'; ...
<br /> 'Test 2', num2str(1.8) , 'KO'};
<br />[nbRows, nbCols] = size(dataCell);
<br />wr.addtable(nbRows, nbCols, dataCell, [1 1]); line break before table
<br />%---
<br />wr.setstyle('Heading 2');
<br />wr.addtext('Sample figure', [0 1]); line break after text
<br />figure; plot(1:10);
<br />title('Figure 1'); xlabel('Temps [s]'); ylabel('Amplitude [A]');
<br />wr.setstyle('Normal');
<br />wr.addfigure();
<br />%---
<br />wr.addpagenumbers('wdAlignPageNumberRight');
<br />wr.updatetoc();
<br />%---
<br />wr.close();
<br />%---
<br />open(reportFilename);</p>
<p>Do not hesitate to ask for more help and more advanced examples, especially when dealing with screenshots of Simulink models and Stateflow charts. I'll be happy to be of any assistance !</p>Laurent Vaylethttp://www.mathworks.com/matlabcentral/fileexchange/authors/24463MATLAB 7.1.0 (R14SP3)Works only on Windows Platforms with at least Office 2000 installed (might also work with Office 97, to investigate...)9112falsetag:www.mathworks.com,2005:FileInfo/231272009-02-26T14:11:03Z2009-04-29T08:17:12ZChanging the color of a block while the simulation runs Did you ever wanted to see the color of a block changing while a simulation is running?<p>This submission contains a level 2 M-file s-function that changes the background color of a block while the simulation runs. </p>
<p>In the block dialog box, specify which block you want to be affected. Look at the M-code to change the logic of color switching to fit your application.</p>Guy Rouleauhttp://www.mathworks.com/matlabcentral/fileexchange/authors/31651MATLAB 7.7 (R2008b)Simulinktruetag:www.mathworks.com,2005:FileInfo/180172007-12-14T12:24:58Z2007-12-14T13:51:56Z3-Phase Vector PlotterThis is a Simulink Block to plot 3-phase graph during simulation<p>This is a tiny project just to show how we can build a useful tools from the available graphics commands in MATLAB .</p>
<p> In this project I had been used the "Plot Annotation" Commands to write a program in Simulink using "Embedded MATLAB Function"
<br />block to plot the vectors in 3-phase systems.</p>
<p> In general this block is useful for power engineers & educational purposes .</p>Saqer Ali Khalilhttp://www.mathworks.com/matlabcentral/fileexchange/authors/27860MATLAB 7.2 (R2006a)MATLAB Compilerfalsetag:www.mathworks.com,2005:FileInfo/49152004-05-12T18:59:25Z2005-05-02T09:50:07Z3DScopeMultitrack 3D Simulink Scope.<p>This block is an enhanced version of the standard XYGraph simulink block.</p>
<p>The standard XYGraph allows to plot the motion of ONE point in the XY plane. This block allows to plot the motion of SEVERAL points in the XYZ space. In other words each point draws a line as it moves, so you end up having several lines in the plot instead of just one. Of course setting the camera position parameter to [0 0 1] reduces the plot to a classic 2D one.</p>
<p>This block is very useful when you have to compare the motion of a point versus a reference trajectory.</p>
<p>The file M2DScope.mdl contains the block.
<br />The file sfunxyz.m is the actual s-function that implements the scope.</p>
<p>Giampy</p>Giampiero Campahttp://www.mathworks.com/matlabcentral/fileexchange/authors/76178MATLAB 5.3 (R11)Simulinktruetag:www.mathworks.com,2005:FileInfo/13712002-02-20T08:20:59Z2005-01-07T10:37:34ZFluid Pipeline Simulink ModelsSimulink blocks for pressure and flow transients in pipelines.<p>These Simulink blocks contain transfer functions that model the pressure and flow transients for axisymmetric 2D viscous flow of a compressible fluid in a straight rigid circular cross section pipelines. Three models are available: </p>
<p>(1) pressures at the ends
<br />(2) flow rates at the ends
<br />(3) pressure at one end and flow rate at the other</p>
<p>Filtering is incorporated to reduce numerical oscillation (Gibbs phenomenon). See J. Dyn. Systems, Meas. & Control vol 122 (2000) pp. 153-162.</p>Robert Pichehttp://www.mathworks.com/matlabcentral/fileexchange/authors/4348MATLAB 5.3 (R11)Simulinkfalse