?? ex1.m
字號:
function [out] = Ex1(x, y, flag)%% Evaluate the right hand side function for the% ODE% % y_1'(x) = y_2(x)% % y_2'(x) = 4*y_1(x) + 3*y_2(x) - 8*exp(x) * cos(2x)% %% This system is equivalent to the second order ODE%% z''(x) - 3 z'(x) - 4 z(x) = - 8 exp(x) * cos(2x)%% The exact solution of the system with initial conditions%% y_1(0) = 2 + 10/13 % y_2(0) = 3 + 14/13%% is given by% y_1(x) = exp(-x) + exp(4*x) % + 10/13 * exp(x) * cos(2x) + 2/13 * exp(x) * sin(2x)% % y_2(x) = -exp(-x) + 4 * exp(4*x) % + 14/13 * exp(x) * cos(2x) - 18/13 * exp(x) * sin(2x)%switch( flag ) case '' % return right hand side out = [ y(2); 4*y(1) + 3*y(2) - 8*exp(x) .* cos(2*x) ]; case 'jacobian' % return Jaacobian of right hand side out = [ 0 1; 4 3 ]; otherwise error (['Unknown request.'])end
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -