


{"id":347836,"date":"2024-01-31T12:23:31","date_gmt":"2024-01-31T12:23:31","guid":{"rendered":"\/forum\/forums\/reply\/347836\/"},"modified":"2024-01-31T12:23:31","modified_gmt":"2024-01-31T12:23:31","slug":"347836","status":"publish","type":"reply","link":"https:\/\/innovationspace.ansys.com\/forum\/forums\/reply\/347836\/","title":{"rendered":"Reply To: the outputs of AWG"},"content":{"rendered":"<p>&lt;p class=&#8221;MsoNormal&#8221;&gt;Dear Jing,&lt;\/p&gt;&lt;p class=&#8221;MsoNormal&#8221;&gt;&nbsp;&lt;\/p&gt;&lt;p class=&#8221;MsoNormal&#8221;&gt;Thank you for contacting us.&lt;\/p&gt;&lt;p class=&#8221;MsoNormal&#8221;&gt;&nbsp;&lt;\/p&gt;&lt;p class=&#8221;MsoNormal&#8221;&gt;To get the plot described in Step 4 of the <a href=\"https:\/\/optics.ansys.com\/hc\/en-us\/articles\/360042800633-Arrayed-waveguide-grating-AWG\">Arrayed waveguide grating (AWG) &ndash; Ansys Optics<\/a>, you need to run the &ldquo;AWG&rdquo; analysis first. Then you can either right-click on the T result that has appeared in the Result View window and visualize it or run a script to do that.&lt;\/p&gt;&lt;p class=&#8221;MsoNormal&#8221;&gt;&lt;span style=&#8221;mso-no-proof: yes;&#8221;&gt;<img loading=\"lazy\" decoding=\"async\" src=\"\/forum\/wp-content\/uploads\/sites\/2\/2024\/01\/31-01-2024-1706702976-mceclip0.png\" width=\"253\" height=\"418\" \/>&lt;br&gt;&lt;!&#8211;[endif]&#8211;&gt;&lt;\/span&gt;&lt;\/p&gt;&lt;p class=&#8221;MsoNormal&#8221;&gt;If you choose the first option, you will need to go to the plot settings to check the &ldquo;log10y&rdquo; option and to change the lambda units.&lt;\/p&gt;&lt;p class=&#8221;MsoNormal&#8221;&gt;&lt;span style=&#8221;mso-no-proof: yes;&#8221;&gt;<img loading=\"lazy\" decoding=\"async\" src=\"\/forum\/wp-content\/uploads\/sites\/2\/2024\/01\/31-01-2024-1706703009-mceclip1.png\" width=\"373\" height=\"358\" \/>&lt;br&gt;&lt;!&#8211;[endif]&#8211;&gt;&lt;\/span&gt;&lt;\/p&gt;&lt;p class=&#8221;MsoNormal&#8221;&gt;<strong>&nbsp;<\/strong>You can also change the axis limits.&lt;\/p&gt;&lt;p class=&#8221;MsoNormal&#8221;&gt;&nbsp;&lt;\/p&gt;&lt;p class=&#8221;MsoNormal&#8221;&gt;If you want to use script so that you can also post-process the results, you can use the following script:&lt;\/p&gt;&lt;p class=&#8221;MsoNormal&#8221;&gt;###################################################################################&lt;\/p&gt;&lt;p class=&#8221;MsoNormal&#8221;&gt;n=8;&lt;\/p&gt;&lt;p class=&#8221;MsoNormal&#8221;&gt;&nbsp;&lt;\/p&gt;&lt;p class=&#8221;MsoNormal&#8221;&gt;Tres=getresult(&#8220;AWG&#8221;,&#8221;T&#8221;);&lt;\/p&gt;&lt;p class=&#8221;MsoNormal&#8221;&gt;lambda=Tres.lambda;&lt;\/p&gt;&lt;p class=&#8221;MsoNormal&#8221;&gt;&nbsp;&lt;\/p&gt;&lt;p class=&#8221;MsoNormal&#8221;&gt;T=matrix(n,length(lambda));&lt;\/p&gt;&lt;p class=&#8221;MsoNormal&#8221;&gt;&nbsp;&lt;\/p&gt;&lt;p class=&#8221;MsoNormal&#8221;&gt;for (i=1:n) {&lt;\/p&gt;&lt;p class=&#8221;MsoNormal&#8221;&gt;&lt;span style=&#8221;mso-spacerun: yes;&#8221;&gt;&nbsp;&nbsp;&nbsp; &lt;\/span&gt;T(i,:)=Tres.getattribute(&#8220;T&#8221;+num2str(i));&lt;\/p&gt;&lt;p class=&#8221;MsoNormal&#8221;&gt;&lt;span style=&#8221;mso-spacerun: yes;&#8221;&gt;&nbsp;&nbsp;&nbsp; &lt;\/span&gt;plot(lambda*1e9,pinch(T,1,i),&#8221;lambda&#8221;, &#8220;T&#8221;);&lt;\/p&gt;&lt;p class=&#8221;MsoNormal&#8221;&gt;&lt;span style=&#8221;mso-spacerun: yes;&#8221;&gt;&nbsp;&nbsp;&nbsp; &lt;\/span&gt;holdon;&lt;\/p&gt;&lt;p class=&#8221;MsoNormal&#8221;&gt;}&lt;\/p&gt;&lt;p class=&#8221;MsoNormal&#8221;&gt;&nbsp;&lt;\/p&gt;&lt;p class=&#8221;MsoNormal&#8221;&gt;leg=cell(n);&lt;\/p&gt;&lt;p class=&#8221;MsoNormal&#8221;&gt;y=linspace(1,n,n);&lt;\/p&gt;&lt;p class=&#8221;MsoNormal&#8221;&gt;for (i=1:n){&lt;\/p&gt;&lt;p class=&#8221;MsoNormal&#8221;&gt;leg{i}=&#8221;Re(T&#8221;+num2str(y(i))+&#8221;)&#8221;;&lt;\/p&gt;&lt;p class=&#8221;MsoNormal&#8221;&gt;}&lt;\/p&gt;&lt;p class=&#8221;MsoNormal&#8221;&gt;&nbsp;&lt;\/p&gt;&lt;p class=&#8221;MsoNormal&#8221;&gt;legend(leg);&lt;\/p&gt;&lt;p class=&#8221;MsoNormal&#8221;&gt;setplot(&#8220;log10y&#8221;,1);&lt;\/p&gt;&lt;p class=&#8221;MsoNormal&#8221;&gt;setplot(&#8220;y max&#8221;,1);&lt;\/p&gt;&lt;p class=&#8221;MsoNormal&#8221;&gt;setplot(&#8220;y min&#8221;,1e-7);&lt;\/p&gt;&lt;p class=&#8221;MsoNormal&#8221;&gt;setplot(&#8220;legend position&#8221;,8);&lt;\/p&gt;&lt;p class=&#8221;MsoNormal&#8221;&gt;holdoff;&lt;\/p&gt;&lt;h6 class=&#8221;MsoNormal&#8221;&gt;#################################################################################&lt;\/h6&gt;&lt;p&gt;The above script should be used as an external script and not in the AWG analysis group. If you want to use it inside the AWG analysis group you can add it at the end of the analysis script but you need to remove the second line (i.e. the&nbsp;T=getresult(&#8220;AWG&#8221;,&#8221;T&#8221;); line).&lt;\/p&gt;&lt;p class=&#8221;MsoNormal&#8221;&gt;Does the above answer your question or do you need something regarding the analysis script?&lt;\/p&gt;&lt;p class=&#8221;MsoNormal&#8221;&gt;&nbsp;&lt;\/p&gt;&lt;p class=&#8221;MsoNormal&#8221;&gt;Best regards,&lt;\/p&gt;&lt;p class=&#8221;MsoNormal&#8221;&gt;Afroditi&lt;\/p&gt;<\/p>\n","protected":false},"template":"","class_list":["post-347836","reply","type-reply","status-publish","hentry"],"aioseo_notices":[],"acf":[],"_links":{"self":[{"href":"https:\/\/innovationspace.ansys.com\/forum\/wp-json\/wp\/v2\/replies\/347836","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/innovationspace.ansys.com\/forum\/wp-json\/wp\/v2\/replies"}],"about":[{"href":"https:\/\/innovationspace.ansys.com\/forum\/wp-json\/wp\/v2\/types\/reply"}],"version-history":[{"count":0,"href":"https:\/\/innovationspace.ansys.com\/forum\/wp-json\/wp\/v2\/replies\/347836\/revisions"}],"wp:attachment":[{"href":"https:\/\/innovationspace.ansys.com\/forum\/wp-json\/wp\/v2\/media?parent=347836"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}