📄 smdode45.mht
字号:
From: <Saved by Windows Internet Explorer 7>
Subject:
Date: Tue, 12 May 2009 09:55:06 -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/smdode45.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>% function file for spring-mass-damper ode45 solution
%
function dydx = smdode45(time,variables)
m = 1; % mass
c = 1; % damping
k = 6; % spring stiffness
t1 = 2; % start time of square wave
t2 = 14; % end time of square wave
fsquare = 10; % square wave amplitude
if (time >= t1) & ( time <= t2) % evaluate forcing function
f = fsquare; % amplitude
else
f = 0;
end
x = variables(1); % the input variables
v = variables(2);
dydx(1) = v; % and their derivatives
dydx(2) = (f - c*v - k*x)/m;
</PRE></BODY></HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -