{"id":2219,"date":"2013-05-20T09:14:14","date_gmt":"2013-05-20T14:14:14","guid":{"rendered":"https:\/\/blogs.mathworks.com\/seth\/?p=2219"},"modified":"2013-05-20T09:14:14","modified_gmt":"2013-05-20T14:14:14","slug":"configuring-models-for-linear-analysis","status":"publish","type":"post","link":"https:\/\/blogs.mathworks.com\/simulink\/2013\/05\/20\/configuring-models-for-linear-analysis\/","title":{"rendered":"Configuring Models for Linear Analysis"},"content":{"rendered":"<p>One of the benefits of Model-Based Design is the ability to perform linear analysis on your non-linear model and design controllers using classical controls techniques.  In R2013a, configuring your model for linear analysis with <a href=\"https:\/\/www.mathworks.com\/products\/simcontrol\/\">Simulink Control Design<\/a> have been greatly improved. Let's take a look at how useful Linear Analysis Points are when performing control related tasks in Simulink.<\/p>\r\n\r\n<p><strong>Why using Linear Analysis Points?<\/strong><\/p>\r\n\r\n<p>Those doing linear analysis with Simulink for a long time are probably familiar with the <tt><a href=\"https:\/\/www.mathworks.com\/help\/simulink\/slref\/linmod.html\">linmod<\/a><\/tt> function. With <tt><a href=\"https:\/\/www.mathworks.com\/help\/simulink\/slref\/linmod.html\">linmod<\/a><\/tt>, the inputs and outputs of the linearization are the root-level Inport and Outport blocks of your model. This means that your model needs to be built in a specific way to accommodate linear analysis.<\/p>\r\n\r\n<p>With Simulink Control Design, you can use Linear Analysis Points to <a href=\"https:\/\/www.mathworks.com\/help\/slcontrol\/ug\/specify-model-portion-to-linearize.html\">specify which portion of a model to linearize<\/a>.<\/p>\r\n\r\n<p>To see all the advantages of Simulink Control Design compared to <tt>linmod<\/tt>, I recommend going through this documentation page: <a href=\"https:\/\/www.mathworks.com\/help\/slcontrol\/ug\/linearizing-nonlinear-models.html#bsp453g-4\">Linearization Using Simulink Control Design Versus Simulink<\/a>.<\/p>\r\n\r\n<p><strong>Specifying Linear Analysis Points in a model<\/strong><\/p>\r\n\r\n<p>Let's take this model as example.<\/p>\r\n\r\n<p><img decoding=\"async\" src=\"https:\/\/blogs.mathworks.com\/images\/seth\/2013Q2\/magball_default.png\" alt=\"Example model to be linearized\" \/><\/p>\r\n\r\n<p>To design a controller, the first thing I am interested in is linearizing the plant. For that, I can right click on the signals entering and exiting the plant, and mark them as Open-loop Input and Open-loop Output. For those already familiar with Simulink Control Design, notice the new improved menu in R2013a.<\/p>\r\n\r\n<p><img decoding=\"async\" src=\"https:\/\/blogs.mathworks.com\/images\/seth\/2013Q2\/newSCDMenu2.png\" alt=\"Linear Analysis Points Menu\" \/><\/p>\r\n\r\n<p>Once this is done, you will see markers in your model for the marked signals.<\/p>\r\n\r\n<p><img decoding=\"async\" src=\"https:\/\/blogs.mathworks.com\/images\/seth\/2013Q2\/model_with_linear_analysis_points.png\" alt=\"model With Linear Analysis Points\" \/><\/p>\r\n\r\n\r\n<p><strong>Specifying Multiple sets of Linear Analysis Points<\/strong><\/p>\r\n\r\n<p>When developing controllers for your model, you will very likely need to accomplish linear analysis multiple times for different parts of your model, open and closed loop, with different inputs and outputs. For that, you can click on <strong>Create new linearization I\/Os...<\/strong> in the Linear Analysis Tool.<\/p>\r\n\r\n<p><img decoding=\"async\" src=\"https:\/\/blogs.mathworks.com\/images\/seth\/2013Q2\/createNewPoints.png\" alt=\"Create new linearization I\/Os...\" \/><\/p>\r\n\r\n<p>This will launch a window where you can define multiple sets of points for your different tasks.<\/p>\r\n\r\n<p><a href=\"https:\/\/blogs.mathworks.com\/images\/seth\/2013Q2\/create_linearization_oi_large.png\"><img decoding=\"async\" src=\"https:\/\/blogs.mathworks.com\/images\/seth\/2013Q2\/create_linearization_oi_small.png\" alt=\"Creating new linearization I\/Os\" \/><\/a><\/p>\r\n\r\n<p>Once you are done, you can select the set of points to be used for linearization.<\/p>\r\n\r\n<p><img decoding=\"async\" src=\"https:\/\/blogs.mathworks.com\/images\/seth\/2013Q2\/using_existingIO.png\" alt=\"Using existing linear analysis points\" \/><\/p>\r\n\r\n<p><strong>Now it's your turn<\/strong><\/p>\r\n\r\n<p>For those familiar with the earlier version of this menu, I recommend looking at the <a href=\"https:\/\/www.mathworks.com\/help\/slcontrol\/release-notes.html\">R2013a release notes<\/a> to find a table describing the mapping between the previous and current Linear Analysis Points menu. Hopefully, this new menu will help avoid confusion when specifying linear analysis points, especially with the open and closed loop concept.<\/p>\r\n\r\n<p>If you prefer, all the above is also available from the command line with functions like <a href=\"https:\/\/www.mathworks.com\/help\/slcontrol\/ug\/linio.html\"><tt>linio<\/tt><\/a>, <a href=\"https:\/\/www.mathworks.com\/help\/slcontrol\/ug\/getlinio.html\"><tt>getlinio<\/tt><\/a>, and <a href=\"https:\/\/www.mathworks.com\/help\/slcontrol\/ug\/setlinio.html\"><tt>setlinio<\/tt><\/a>.<\/p>\r\n\r\n<p>Give that a try and let us know what you think by leaving a <a href=\"https:\/\/blogs.mathworks.com\/seth\/?p=2219&#comment\">comment here<\/a>.<\/p>","protected":false},"excerpt":{"rendered":"<div class=\"overview-image\"><img decoding=\"async\"  class=\"img-responsive\" src=\"https:\/\/blogs.mathworks.com\/images\/seth\/2013Q2\/using_existingIO.png\" onError=\"this.style.display ='none';\" \/><\/div><p>One of the benefits of Model-Based Design is the ability to perform linear analysis on your non-linear model and design controllers using classical controls techniques.  In R2013a, configuring your... <a class=\"read-more\" href=\"https:\/\/blogs.mathworks.com\/simulink\/2013\/05\/20\/configuring-models-for-linear-analysis\/\">read more >><\/a><\/p>","protected":false},"author":41,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[121,115,16],"tags":[247,248,116],"_links":{"self":[{"href":"https:\/\/blogs.mathworks.com\/simulink\/wp-json\/wp\/v2\/posts\/2219"}],"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=2219"}],"version-history":[{"count":27,"href":"https:\/\/blogs.mathworks.com\/simulink\/wp-json\/wp\/v2\/posts\/2219\/revisions"}],"predecessor-version":[{"id":2261,"href":"https:\/\/blogs.mathworks.com\/simulink\/wp-json\/wp\/v2\/posts\/2219\/revisions\/2261"}],"wp:attachment":[{"href":"https:\/\/blogs.mathworks.com\/simulink\/wp-json\/wp\/v2\/media?parent=2219"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blogs.mathworks.com\/simulink\/wp-json\/wp\/v2\/categories?post=2219"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blogs.mathworks.com\/simulink\/wp-json\/wp\/v2\/tags?post=2219"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}