teach2.m
来自「MATLAB的基本操作与使用」· M 代码 · 共 23 行
M
23 行
%绘制二元函数的三维曲面图
[ x,y ] = meshgrid(-3:1/8:3);
z = 3*(1-x).^2.*exp(-(x.^2) - (y+1).^2) - 10*(x/5 - x.^3 - y.^5) ...
.*exp(-x.^2 - y.^2) - 1/3*exp(-(x+1).^2 - y.^2); ,pause
figure(1), surf(x,y,z), shading interp; colorbar, set(gcf,'position',[7 305 501 380]) ,pause
%求解常微分方程
t_final=100; x0=[0; 0; 1e-10];
[t,x] = ode45('lorenzeq',[0, t_final], x0);
figure(1); plot(t,x), set(gcf,'position',[7 305 501 380])
%figure(2); plot3(x(:,1), x(:,2), x(:,3)); axis([10 40 -20 20 -20 20])
figure(2); line(x(:,1), x(:,2), x(:,3)); axis([10 40 -20 20 -20 20])
set(gcf,'position',[516 305 501 380])
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?