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

📄 ex23ch2.m

📁 these codes are for solving OED with matlab
💻 M
字号:
function ex23ch2% x = y(1), x' = v = y(2)options = odeset('Events',@event);[t,y,te,ye,ie] = ode45(@odes,[0,100],[0;0],options);if isempty(ie)    error('Cork did not leave bottle by t = 100.')endfprintf('Cork left bottle at t = %g with speed v(t) = %g. \n',...         te(end),ye(end,2))%========================================================function dydt = odes(t,y)g = 9.81;q = 20;d = 5;gamma = 1.4;R = 4;L = 3.75;dydt = [y(2); 0];dydt(2) = g*(1+q)*((1 + y(1)/d)^(-gamma) + R*t/100 - 1 + ...                    q*y(1)/(L*(1+q)));function [value,isterminal,direction] = event(t,y)L = 3.75;value = y(1) - L;isterminal = 1;direction = 0;

⌨️ 快捷键说明

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