基本操作-5/(4.8+5.32)^2 area=pi*2.5^2 x1=1+1/2+1/3+1/4+1/5+1/6 exp(acos(0.3)) a=[1 2 3;4 5 6;7 8 9] a=[1:3,4:6,7:9] a1=[6: -1:1] a=eye(4) a1=eye(2,3) b=zeros(2,10) c=ones(2,10) c1=8*ones(3,5) d=zeros(3,2,2);r1=rand(2, 3) r2=5-10*rand(2, 3) r4=2*randn(2,3)+3 arr1=[1.1 -2.2 3.3 -4.4 5.5] arr1(3) arr1([1 4]) arr1(1:2:5) arr2=[1 2 3; -2 -3 -4;3 4 5] arr2(1,:) arr2(:,1:2:3) arr3=[1 2 3 4 5 6 7 8] arr3(5:end) arr3(end) 绘图x=[0:1:10]; y=x.^2-10*x+15; plot(x,y) x=0:pi/20:2*pi y1=sin(x);y2=cos(x); plot(x,y1,'b-'); hold on; plot(x,y2,‘k--’ );legend (‘ sin x’ , ‘ cos x ’ );x=0:pi/20:2*pi; y=sin(x); figure(1) plot(x,y, 'r-') grid on 以二元函数图 z = xexp(-x^2-y^2) 为例讲解基本操作, 首先需要利用 meshgrid函数生成 X-Y 平面的网格数据,如下所示:xa = -2:0.2:2; ya = xa; [x,y] = meshgrid(xa,ya); z = x.*exp(-x.^2 - y.^2); mesh(x,y,z); 建立 M 文件function fenshu( grade )if grade > 95.0 disp('The grade is A.');elseif grade > 86.0 disp('The grade is B.');elseif grade > 76.0 disp('The grade is C.');elseif grade > 66.0 disp('The grade is D.');else disp('The grade is F.');endendendendendfunction y=func(x) if abs(x)<1 y=sqrt(1-x^2); else y=x^2-1; endfunction summ( n)i = 1; sum = 0;while ( i <= n ) sum = sum+i; i = i+1;end str = ['????? á 1??a£o',num2str(sum)]; disp(str) end求极限syms x limit((1+x)^(1 /x),x,0,'right') 求导数syms x; f=(sin(x)/x); diff(f) diff(log(sin(x))) 求积分syms x; int(x^2*log(x)) syms x; int(abs(x-1),0,2) 常微分方程求解dsolve('Dy+2*x*y=x*exp(-x^2)','x') 计算偏导数x/(x^2 + y^2 + z^2)^(1 /2) diff((x^2+y^2+z^2)^(1 /2),x,2) 重积分int(int(x*y,y,2*x,x^2+1),x,0,1) 级数syms n; symsum(1/2^n,1,inf) Taylor 展开式求 y=exp(x)在 x=0 处的 5 阶 Taylor 展开式taylor(exp(x),0,6) 矩阵求逆A=[0 -6 -1; 6 2 -16; -5 20 -10] det(A) inv(A) 特征值、特征向量和特征多项式A=[0...