{"id":556,"date":"2017-09-14T13:37:01","date_gmt":"2017-09-14T16:37:01","guid":{"rendered":"http:\/\/www.professores.uff.br\/diomarcesarlobao\/?page_id=556"},"modified":"2017-09-14T13:37:01","modified_gmt":"2017-09-14T16:37:01","slug":"shooting-m","status":"publish","type":"page","link":"https:\/\/www.professores.uff.br\/diomarcesarlobao\/shooting-m\/","title":{"rendered":"shooting.m"},"content":{"rendered":"<pre>%\r\n% Shooting method example of solving boundary value ODE\r\n%\r\n%     d^2 T   \r\n%     -----  + c (Tinf - T) = 0\r\n%      dx^2\r\n%\r\n% which models the temperature distribution in a rod\r\n%\r\n% Will be solved using Euler's method\r\n\r\n% define constants\r\n\r\nTa   = 40;      % left side temperature\r\nTb   = 200;     % right side temperature\r\nTinf = 20;      % ambient temperature\r\nc    = 0.01;    % constant\r\n\r\nL      = 10;    % length of bar\r\nx      = 0;     % start position\r\ndeltax = 0.01;  % increment in position for numerical procedure\r\n\r\nT = Ta;         % initial condition\r\nz = input('Enter starting slope: ');\r\n\r\ncount = 1;\r\nTvect(count) = T;\r\nxvect(count) = x;\r\n\r\nwhile x &lt; L\r\n  dTdx = z;\r\n  dzdx = -c * (Tinf - T);\r\n\r\n  T = T + dTdx * deltax;  % Euler's method\r\n  z = z + dzdx * deltax;\r\n\r\n  x = x + deltax;\r\n\r\n  count = count + 1;\r\n  xvect(count) = x;       % store values for plotting\r\n  Tvect(count) = T;\r\nend;\r\n\r\nfprintf('The end temperature is: %f\\n',T);\r\n\r\nplot(xvect,Tvect);<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>% % Shooting method example of solving boundary value ODE % % d^2 T % &#8212;&#8211; + c (Tinf &#8211; T) = 0 % dx^2 % % which models the temperature distribution in a rod % % Will be solved using Euler&#8217;s method % define constants Ta = 40; % left side temperature Tb = [&hellip;]<\/p>\n","protected":false},"author":22,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"_exactmetrics_skip_tracking":false,"_exactmetrics_sitenote_active":false,"_exactmetrics_sitenote_note":"","_exactmetrics_sitenote_category":0,"footnotes":""},"categories":[],"tags":[],"class_list":["post-556","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/www.professores.uff.br\/diomarcesarlobao\/wp-json\/wp\/v2\/pages\/556","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.professores.uff.br\/diomarcesarlobao\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/www.professores.uff.br\/diomarcesarlobao\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/www.professores.uff.br\/diomarcesarlobao\/wp-json\/wp\/v2\/users\/22"}],"replies":[{"embeddable":true,"href":"https:\/\/www.professores.uff.br\/diomarcesarlobao\/wp-json\/wp\/v2\/comments?post=556"}],"version-history":[{"count":1,"href":"https:\/\/www.professores.uff.br\/diomarcesarlobao\/wp-json\/wp\/v2\/pages\/556\/revisions"}],"predecessor-version":[{"id":558,"href":"https:\/\/www.professores.uff.br\/diomarcesarlobao\/wp-json\/wp\/v2\/pages\/556\/revisions\/558"}],"wp:attachment":[{"href":"https:\/\/www.professores.uff.br\/diomarcesarlobao\/wp-json\/wp\/v2\/media?parent=556"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.professores.uff.br\/diomarcesarlobao\/wp-json\/wp\/v2\/categories?post=556"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.professores.uff.br\/diomarcesarlobao\/wp-json\/wp\/v2\/tags?post=556"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}