{"id":516,"date":"2017-09-14T13:16:31","date_gmt":"2017-09-14T16:16:31","guid":{"rendered":"http:\/\/www.professores.uff.br\/diomarcesarlobao\/?page_id=516"},"modified":"2017-09-14T13:16:31","modified_gmt":"2017-09-14T16:16:31","slug":"simp1-m","status":"publish","type":"page","link":"https:\/\/www.professores.uff.br\/diomarcesarlobao\/simp1-m\/","title":{"rendered":"simp1.m"},"content":{"rendered":"<pre>function q = simp1(y,h);\r\n% function simp1(y,h);     Simpson's 1\/3 quadrature rule\r\n%\r\n%   input: y - function vector to be integrated\r\n%          h - interval width\r\n%  output: integral in the given region\r\n\r\nn = length(y) - 1;         % number of regions\r\nif (n\/2) ~= floor(n\/2)     % check to see if even\r\n  fprintf('\\nError: must have odd number of data points\\n');\r\n  break;\r\nend\r\n\r\nv  = 2 * ones(n+1,1);      % these commands form : 2 4 2 4 ... 4 2 4 2\r\nv2 = 2 * ones(n\/2,1);\r\nv(2:2:n) = v(2:2:n) + v2;     \r\n\r\nv(1) = 1;                  % this correct the end points\r\nv(n+1) = 1;\r\n\r\nq = y * v;                 % row vector * column vector = sum(y_i * v_i)\r\nq = q * h\/3;<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>function q = simp1(y,h); % function simp1(y,h); Simpson&#8217;s 1\/3 quadrature rule % % input: y &#8211; function vector to be integrated % h &#8211; interval width % output: integral in the given region n = length(y) &#8211; 1; % number of regions if (n\/2) ~= floor(n\/2) % check to see if even fprintf(&#8216;\\nError: must have [&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-516","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/www.professores.uff.br\/diomarcesarlobao\/wp-json\/wp\/v2\/pages\/516","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=516"}],"version-history":[{"count":1,"href":"https:\/\/www.professores.uff.br\/diomarcesarlobao\/wp-json\/wp\/v2\/pages\/516\/revisions"}],"predecessor-version":[{"id":517,"href":"https:\/\/www.professores.uff.br\/diomarcesarlobao\/wp-json\/wp\/v2\/pages\/516\/revisions\/517"}],"wp:attachment":[{"href":"https:\/\/www.professores.uff.br\/diomarcesarlobao\/wp-json\/wp\/v2\/media?parent=516"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.professores.uff.br\/diomarcesarlobao\/wp-json\/wp\/v2\/categories?post=516"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.professores.uff.br\/diomarcesarlobao\/wp-json\/wp\/v2\/tags?post=516"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}