{"id":173,"date":"2012-01-04T21:25:32","date_gmt":"2012-01-05T02:25:32","guid":{"rendered":"https:\/\/blogs.mathworks.com\/seth\/?p=173"},"modified":"2018-09-11T12:57:58","modified_gmt":"2018-09-11T17:57:58","slug":"frames-from-signals-to-blocks","status":"publish","type":"post","link":"https:\/\/blogs.mathworks.com\/simulink\/2012\/01\/04\/frames-from-signals-to-blocks\/","title":{"rendered":"Frames&#8230; from signals to blocks"},"content":{"rendered":"<p>Today I want to talk about an important topic for <a href=\"https:\/\/www.mathworks.com\/products\/dsp-system\/\">DSP System Toolbox<\/a> and <a href=\"https:\/\/www.mathworks.com\/products\/communications.html\">Communications Toolbox<\/a> users: <a href=\"https:\/\/www.mathworks.com\/help\/releases\/R2011b\/toolbox\/dsp\/ug\/bso3pkj.html\">Frame-Based Processing<\/a><\/p>\r\n\r\n<p>Beginning in R2010b, MathWorks started to significantly change the handling of frame- and sample-based processing. Currently, we are in a transition phase and it's time to update your models to the new paradigm.<\/p>\r\n\r\n<p><strong>Sample-based processing vs. frame-based processing<\/strong><\/p>\r\n\r\n<p>Let's begin by a quick explanation of the difference between frame-based and sample-based processing.<\/p>\r\n\r\n<p>Let's say I have a signal of dimensions <tt>3x2<\/tt>. If I process this signal in a sample-based manner, every simulation step I will process the 6 elements individually as 6 independent channels:<\/p>\r\n\r\n<p><img decoding=\"async\" src=\"https:\/\/blogs.mathworks.com\/images\/seth\/2011Q4\/oneSample.png\" alt=\"One sample\"><\/p>  \r\n\r\n<p>In frame-based processing, blocks process signals multiple sequential samples per time step. For example, a <tt>3x2<\/tt> matrix like in the previous example could contain only 2 independent channels. For each channel, this matrix contains a frame of 3 samples:<\/p>\r\n\r\n<p><img decoding=\"async\" src=\"https:\/\/blogs.mathworks.com\/images\/seth\/2011Q4\/OneFrameBased.png\" alt=\"One frame\"><\/p>  \r\n\r\n\r\n<p>As you can guess, frame-based processing can lead to significant performance improvements because each block operates on frames of data rather than on individual samples, and interblock communication is reduced.<\/p>\r\n\r\n\r\n <p><strong>Changes to Frame-Based Processing<\/strong><\/p>\r\n\r\n<p>Historically, in Simulink the frame status has always been an attribute of the signals, like data type and dimensions.<\/p>\r\n\r\n<p>This can be seen by looking at the <tt>CompiledPortFrameData<\/tt> property of an Output port with a code like the following:<\/p>\r\n\r\n<code>\r\nmodelname([],[],[],'compile')<br>\r\nph = get_param('modelname\/White Noise','PortHandles')<br>\r\nget_param(ph.Outport,'CompiledPortFrameData')<br>\r\nmodelname([],[],[],'term')<br>\r\n<\/code>\r\n\r\n<p>Beginning in R2010b, we started to significantly change the handling of frame- and sampled-based processing. In the future, frame status will no longer be a signal attribute. Instead, individual blocks will control whether they treat inputs as frames of data or as samples of data.<\/p>\r\n\r\n<p>This means that many blocks in the DSP System Toolbox and Communications Toolbox now have an <strong>Input Processing<\/strong> option where they can decide to process columns as channels (frame-based) or elements as channels (sample-based). You can notice in the following image that the block dialog clearly mentions that the option to inherit the processing type from the input signal will be removed in the future.<\/p>\r\n\r\n<p><img decoding=\"async\" src=\"https:\/\/blogs.mathworks.com\/images\/seth\/2011Q4\/DelayDialog.png\" alt=\"One frame\"><\/p>  \r\n\r\n<p>To open a demo model highlighting the effects of this setting, type <tt>ex_inputprocessing<\/tt> at the MATLAB prompt.<\/p>\r\n\r\n\r\n<p><strong>What should I do to update my model?<\/strong><\/p>\r\n\r\n<p>One word: <a href=\"https:\/\/www.mathworks.com\/help\/releases\/R2011b\/toolbox\/simulink\/slref\/slupdate.html\">slupdate<\/a><\/p>\r\n\r\n<p>During the transition phase, the frame information is still propagated through the signals in your model. Based on this information, <a href=\"https:\/\/www.mathworks.com\/help\/releases\/R2011b\/toolbox\/simulink\/slref\/slupdate.html\">slupdate<\/a> can automatically configure the blocks for the new paradigm.<\/p>\r\n\r\n<p>In the future, the frame information will be removed from signals and you will no longer be able to upgrade your models using the <a href=\"https:\/\/www.mathworks.com\/help\/releases\/R2011b\/toolbox\/simulink\/slref\/slupdate.html\">slupdate<\/a> function. Therefore, you should upgrade your existing models using <a href=\"https:\/\/www.mathworks.com\/help\/releases\/R2011b\/toolbox\/simulink\/slref\/slupdate.html\">slupdate<\/a> as soon as possible.<\/p>\r\n\r\n<p><strong>Now it's your turn<\/strong><\/p>\r\n\r\nGive a look at the <a href=\"https:\/\/www.mathworks.com\/help\/releases\/R2011b\/toolbox\/dsp\/rn\/bs1rpm7.html\">R2011a<\/a> and <a href=\"https:\/\/www.mathworks.com\/help\/releases\/R2011b\/toolbox\/dsp\/rn\/bqmfe_z-10.html\">2011b<\/a> release notes of the DSP System Toolbox and let us know what you think by leaving a <a href=\"https:\/\/blogs.mathworks.com\/seth\/?p=161&amp;#comment\">comment here<\/a>.<\/p>\r\n\r\n\r\n\r\n\r\n\r\n\r\n","protected":false},"excerpt":{"rendered":"<p>Today I want to talk about an important topic for DSP System Toolbox and Communications Toolbox users: Frame-Based Processing\r\n\r\nBeginning in R2010b, MathWorks started to significantly change the... <a class=\"read-more\" href=\"https:\/\/blogs.mathworks.com\/simulink\/2012\/01\/04\/frames-from-signals-to-blocks\/\">read more >><\/a><\/p>","protected":false},"author":41,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[7,73,11,16],"tags":[237,238,457],"_links":{"self":[{"href":"https:\/\/blogs.mathworks.com\/simulink\/wp-json\/wp\/v2\/posts\/173"}],"collection":[{"href":"https:\/\/blogs.mathworks.com\/simulink\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blogs.mathworks.com\/simulink\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blogs.mathworks.com\/simulink\/wp-json\/wp\/v2\/users\/41"}],"replies":[{"embeddable":true,"href":"https:\/\/blogs.mathworks.com\/simulink\/wp-json\/wp\/v2\/comments?post=173"}],"version-history":[{"count":5,"href":"https:\/\/blogs.mathworks.com\/simulink\/wp-json\/wp\/v2\/posts\/173\/revisions"}],"predecessor-version":[{"id":7953,"href":"https:\/\/blogs.mathworks.com\/simulink\/wp-json\/wp\/v2\/posts\/173\/revisions\/7953"}],"wp:attachment":[{"href":"https:\/\/blogs.mathworks.com\/simulink\/wp-json\/wp\/v2\/media?parent=173"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blogs.mathworks.com\/simulink\/wp-json\/wp\/v2\/categories?post=173"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blogs.mathworks.com\/simulink\/wp-json\/wp\/v2\/tags?post=173"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}