ex5_4.m
来自「Advanced Engineering Mathematics using M」· M 代码 · 共 22 行
M
22 行
% EX5_4.M Solve symbolically the second order equation% D2y+b*Dy+c*y=0 and plot for b=1, b=3 with c=1.% sym('b')y = dsolve('D2y+b*Dy+1*y=0','y(0)=1','Dy(0)=0','t');y=simple(y) % Simplify the solution% Substitute values b=1 and b=3clf % Clear any figures andhold on % plot multiple graphsezplot(subs(y,'b',3.0),[0,10])gtext('b=3') % Annotate text with mouseezplot(subs(y,'b',1.0),[0,10])gtext('b=1') title('Solution to D2y+b*Dy+y=0, y(0)=1,Dy(0)=0')ylabel('y(t)')gridhold off % Default setting%% Make this script more general; i.e. plot arbitrary % values of b and different ranges of t%% Version 5 Add sym and modify call to subs
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?