⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 shooting.mht

📁 it is a very essential matlab code.
💻 MHT
字号:
From: <Saved by Windows Internet Explorer 7>
Subject: 
Date: Tue, 12 May 2009 09:55:55 -0700
MIME-Version: 1.0
Content-Type: text/html;
	charset="Windows-1252"
Content-Transfer-Encoding: 7bit
Content-Location: http://www.mece.ualberta.ca/Courses/mec390/390code/shooting.m
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.3350

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=windows-1252">
<META content="MSHTML 6.00.6000.16825" name=GENERATOR></HEAD>
<BODY><PRE>%
% Shooting method example of solving boundary value ODE
%
%     d^2 T   
%     -----  + c (Tinf - T) = 0
%      dx^2
%
% which models the temperature distribution in a rod
%
% Will be solved using Euler's method

% define constants

Ta   = 40;      % left side temperature
Tb   = 200;     % right side temperature
Tinf = 20;      % ambient temperature
c    = 0.01;    % constant

L      = 10;    % length of bar
x      = 0;     % start position
deltax = 0.01;  % increment in position for numerical procedure

T = Ta;         % initial condition
z = input('Enter starting slope: ');

count = 1;
Tvect(count) = T;
xvect(count) = x;

while x &lt; L
  dTdx = z;
  dzdx = -c * (Tinf - T);

  T = T + dTdx * deltax;  % Euler's method
  z = z + dzdx * deltax;

  x = x + deltax;

  count = count + 1;
  xvect(count) = x;       % store values for plotting
  Tvect(count) = T;
end;

fprintf('The end temperature is: %f\n',T);

plot(xvect,Tvect);
</PRE></BODY></HTML>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -