<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>张鹏博客 &#187; matlab</title>
	<atom:link href="http://www.zhangpeng.info/tag/matlab/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.zhangpeng.info</link>
	<description>简单生活，分享快乐</description>
	<lastBuildDate>Fri, 10 Sep 2010 03:01:04 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
	
<!-- Start Of Script Generated By WP-PostViews Plus -->
<script type='text/javascript' src='http://www.zhangpeng.info/wp-includes/js/jquery/jquery.js?ver=1.4.2'></script>
<script type="text/javascript">
/* <![CDATA[ */
jQuery.ajax({type:'GET',url:'http://www.zhangpeng.info/wp-content/plugins/wp-postviews-plus/postviews_plus.php',data:'todowppvp=add&type=tag&id=105_1',cache:false,dataType:'script'});
/* ]]> */
</script>
<!-- End Of Script Generated By WP-PostViews Plus -->
	<item>
		<title>Thermal numerical method：Improved Euler method</title>
		<link>http://www.zhangpeng.info/2010/thermal-numerical-method-improved-euler-method/</link>
		<comments>http://www.zhangpeng.info/2010/thermal-numerical-method-improved-euler-method/#comments</comments>
		<pubDate>Thu, 07 Jan 2010 02:36:41 +0000</pubDate>
		<dc:creator>张鹏</dc:creator>
				<category><![CDATA[English]]></category>
		<category><![CDATA[Study]]></category>
		<category><![CDATA[CFD]]></category>
		<category><![CDATA[matlab]]></category>

		<guid isPermaLink="false">http://www.zhangpeng.info/?p=234</guid>
		<description><![CDATA[The idea of Euler method is to use an approximation yn stands for the real y(xn) and then use the inverse multiply  a step to calculate the yn+1. When we use a small step &#8216;h&#8217;, we will gain a curve similar to the real line. For more accurate, we improve the Euler method and it [...]]]></description>
			<content:encoded><![CDATA[<p>The idea of Euler method is to use an approximation y<sub>n </sub>stands for the real y(x<sub>n</sub>) and then use the inverse multiply  a step to calculate the y<sub>n+1</sub>. When we use a small step &#8216;h&#8217;, we will gain a curve similar to the real line. For more accurate, we improve the Euler method and it let us calculate with less works.<span id="more-234"></span></p>
<p>We first use the Euler method to get a <span style="text-decoration: overline;">y</span><sub>n+1 </sub>in the Improved Euler method. Then we use another method to amend the <span style="text-decoration: overline;">y</span><sub>n+1</sub> to let it more similar to the real y<sub>n+1</sub>.</p>
<p>We express this new Improved Euler method by these two formulas:</p>
<p>y<sub>n+1</sub> = <span style="text-decoration: overline;">y</span><sub>n</sub> + hf (x<sub>n</sub> , y<sub>n</sub> )<br />
 y<sub>n+1</sub> = y<sub>n</sub> + h*[f (x<sub>n</sub> , y<sub>n</sub> )+f (x<sub>n+1</sub> , <span style="text-decoration: overline;">y</span><sub>n+1</sub> )]/2</p>
<p>When use computer for calculation in some <a href="http://www.articleinput.com/e/s/s/Engineering/" target="_blank">engineering</a> field, you should show the relationship between &#8216;y&#8217; and &#8216;x&#8217;. You need also give a &#8216;h&#8217;.</p>
<h2>A example to use Improved Euler method for solving heat transfer problem:(Use Matlab)</h2>
<div id="attachment_211" class="wp-caption alignright" style="width: 460px"><a href="http://zhangpeng.info/wp-content/uploads/2009/12/euler.GIF"><img class="size-medium wp-image-211" title="euler" src="http://zhangpeng.info/wp-content/uploads/2009/12/euler-450x186.GIF" alt="Improved Euler method used in heat transfer calculation" width="450" height="186" /></a><p class="wp-caption-text">Euler method used in heat transfer calculation</p></div>
<p><strong>Question</strong>: As the figure shows. T<sub>∞</sub>=1500℃，T<sub>w</sub>=500 ℃, T<sub>0</sub>=20℃, a thermocouple which diameter is 1mm exposed in the air. The surface coefficient of heat transfer h=200W(m<sup>2</sup>/K)，ε=0.2. Thermocouple oxidation will create energy at a rate of q=1000W/m<sup>3</sup>.  Determine the relation ship between temperature of <a href="http://www.zhangpeng.info/2009/new-type-of-thermocouple/">thermocouple</a> and time. [additional properties of thermocouple:ρ=8000kg/m<sup>3</sup>，c=0.38kJ/(kg*K)，λ=50W/(m*K)]</p>
<p><strong>Answer</strong>: We use Improved Euler Question to solve this problem.  www.zhangpeng.info</p>
<p>The source code in Matlab here:</p>
<blockquote><p><code>function [x,y]=eulerg(x,y,h,N)<br />
 x=zeros(1,N+1);<br />
 y=zeros(1,N+1);<br />
 x(1)=0;<br />
 y(1)=293;<br />
 for n=1:N<br />
 x(n+1)=x(n)+h;<br />
 ybar=y(n)+h*dyfun(x(n),y(n));<br />
 y(n+1)=y(n)+(h/2)*(dyfun(x(n),y(n))+dyfun(x(n),ybar));<br />
 end<br />
 plot(x,y,'red');<br />
 function m=dyfun(x,y)<br />
 m=1/304+75/19*(1773-y)+(6.804e-8)/304*(1773^4-y^4);</code></p>
</blockquote>
<p>To create a new file in Matlab writing these codes and save it. Input some properties, for example eulerg(0,293,0.001,1000), and you will gain the relationship line between &#8216;y&#8217; and &#8216;x&#8217;.</p>
<p>You can transfer this example in any other similar <a href="http://www.articleinput.com/e/a/title/The-basic-work-site-settings-are-not-part-of-the-productive-work-process/" target="_blank">work process</a> by just change some part of this example function. I&#8217;m glad to discuss with you if you have any questions.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.zhangpeng.info/2010/thermal-numerical-method-improved-euler-method/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>热工数值方法-改进尤拉方法</title>
		<link>http://www.zhangpeng.info/2009/euler/</link>
		<comments>http://www.zhangpeng.info/2009/euler/#comments</comments>
		<pubDate>Wed, 02 Dec 2009 15:17:21 +0000</pubDate>
		<dc:creator>张鹏</dc:creator>
				<category><![CDATA[Study]]></category>
		<category><![CDATA[matlab]]></category>
		<category><![CDATA[传热]]></category>
		<category><![CDATA[热工数值方法]]></category>

		<guid isPermaLink="false">http://zhangpeng.info/?p=210</guid>
		<description><![CDATA[首先，什么是尤拉方法？尤拉方法的思想是利用近似值yn代替y(xn)的值，然后利用曲线倒数乘以一个设定的步长得出yn+1的值，当我们设定的步长比较小的时候，所得的拟合曲线便会有足够的精度，然而为进一步提高计算的精度，结合梯形方法即可以形成改进尤拉格式，这样在进行热工数值计算时能够使精度足够且计算量较小。 在这种改进的尤拉格式中，先用尤拉方法求得一个初步的近似值，记yn+1，这一步即预报，然后再通过梯形方法对这一预报值进行修正，得到较为精确的yn+1值，这是一种热工数值计算中常用的方法。 这一方法可以表示为以下的两式： 预报: yn+1 = yn + hf (xn , yn ) 校正: yn+1 = yn + h*[f (xn , yn )+f (xn+1 , yn+1 )]/2 在计算机求解的时候，我们需要给出一个y关于x的函数，同时设定步长h，这个函数不管是显式或者隐式的函数都可以。 Matlab中利用改进尤拉方法计算传热问题举例： 题：薄壁物体温度响应的数值求解。如图所示，T∞=1500℃，Tw=500 ℃。从某时刻起，T0=20℃，直径1mm的热电偶结点置于高温气体中，气流对热电偶的表面换热系数 h=200W(m2/K)，结点表面发射率 ε=0.2，高温气流对金属的氧化作用使热电偶结点产生一定的热量，其强度为 q=1000W/m3，求热电偶结点的温度响应。结点材料：ρ=8000kg/m3，c=0.38kJ/(kg*K)，λ=50W/(m*K) 解：我们在这里使用改进尤拉方法进行热工数值计算。www.zhangpeng.info Matlab源代码如下： function [x,y]=eulerg(x,y,h,N) x=zeros(1,N+1); y=zeros(1,N+1); x(1)=0; y(1)=293; for n=1:N x(n+1)=x(n)+h; ybar=y(n)+h*dyfun(x(n),y(n)); y(n+1)=y(n)+(h/2)*(dyfun(x(n),y(n))+dyfun(x(n),ybar)); end plot(x,y,'red'); function m=dyfun(x,y) m=1/304+75/19*(1773-y)+(6.804e-8)/304*(1773^4-y^4); 在 matlab 中新建文件写入代码保存后，输入例如：eulerg(0,293,0.001,1000) [...]]]></description>
			<content:encoded><![CDATA[<p>首先，什么是尤拉方法？尤拉方法的思想是利用近似值y<sub>n</sub>代替y(x<sub>n</sub>)的值，然后利用曲线倒数乘以一个设定的步长得出y<sub>n+1</sub>的值，当我们设定的步长比较小的时候，所得的拟合曲线便会有足够的精度，然而为进一步提高计算的精度，结合梯形方法即可以形成改进尤拉格式，这样在进行<a href="http://www.zhangpeng.info/2009/thermal-test-instruments-exam/" target="_blank">热工数值计算</a>时能够使精度足够且计算量较小。</p>
<p><span id="more-210"></span>在这种改进的尤拉格式中，先用尤拉方法求得一个初步的近似值，记<span style="text-decoration: overline;">y</span><sub>n+1</sub>，这一步即预报，然后再通过梯形方法对这一预报值进行修正，得到较为精确的y<sub>n+1</sub>值，这是一种热工数值计算中常用的方法。</p>
<p>这一方法可以表示为以下的两式：</p>
<ul>
<li>预报: y<sub>n+1</sub> = <span style="text-decoration: overline;">y</span><sub>n</sub> + hf (x<sub>n</sub> , y<sub>n</sub> )</li>
<li>校正: y<sub>n+1</sub> = y<sub>n</sub> + h*[f (x<sub>n</sub> , y<sub>n</sub> )+f (x<sub>n+1</sub> , <span style="text-decoration: overline;">y</span><sub>n+1</sub> )]/2</li>
</ul>
<p>在计算机求解的时候，我们需要给出一个y关于x的函数，同时设定步长h，这个函数不管是显式或者隐式的函数都可以。</p>
<h3>Matlab中利用改进尤拉方法计算传热问题举例：</h3>
<div id="attachment_211" class="wp-caption alignright" style="width: 460px"><a href="http://zhangpeng.info/wp-content/uploads/2009/12/euler.GIF"><img class="size-medium wp-image-211" title="euler" src="http://zhangpeng.info/wp-content/uploads/2009/12/euler-450x186.GIF" alt="尤拉格式计算传热问题" width="450" height="186" /></a><p class="wp-caption-text">尤拉格式计算传热问题</p></div>
<p><strong>题</strong>：薄壁物体温度响应的数值求解。如图所示，T<sub>∞</sub>=1500℃，T<sub>w</sub>=500 ℃。从某时刻起，T<sub>0</sub>=20℃，直径1mm的热电偶结点置于高温气体中，气流对热电偶的表面换热系数 h=200W(m<sup>2</sup>/K)，结点表面发射率 ε=0.2，高温气流对金属的氧化作用使<a href="http://www.zhangpeng.info/2009/new-thermalcouple-idea/" target="_blank">热电偶</a>结点产生一定的热量，其强度为 q=1000W/m3，求热电偶结点的温度响应。结点材料：ρ=8000kg/m<sup>3</sup>，c=0.38kJ/(kg*K)，λ=50W/(m*K)</p>
<p><strong>解</strong>：我们在这里使用改进尤拉方法进行热工数值计算。www.zhangpeng.info</p>
<p>Matlab源代码如下：</p>
<blockquote><p><code>function [x,y]=eulerg(x,y,h,N)<br />
 x=zeros(1,N+1);<br />
 y=zeros(1,N+1);<br />
 x(1)=0;<br />
 y(1)=293;<br />
 for n=1:N<br />
 x(n+1)=x(n)+h;<br />
 ybar=y(n)+h*dyfun(x(n),y(n));<br />
 y(n+1)=y(n)+(h/2)*(dyfun(x(n),y(n))+dyfun(x(n),ybar));<br />
 end<br />
 plot(x,y,'red');<br />
 function m=dyfun(x,y)<br />
 m=1/304+75/19*(1773-y)+(6.804e-8)/304*(1773^4-y^4);</code></p>
</blockquote>
<p>在 matlab 中新建文件写入代码保存后，输入例如：eulerg(0,293,0.001,1000) 即可以得出热电偶温度y随时间x的变化规律曲线。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.zhangpeng.info/2009/euler/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
