- 1.1 lnx表示成log(x),而lgx表示成log10(x)。注意点乘
a=[2 1+2i;-0.45 5]; Z2=@(x)1/2*log(x+sqrt(1+x.*x)); A=Z2(a)
A =
0.7218 + 0.0000i 0.7347 + 0.5317i
-0.2180 + 0.0000i 1.1562 + 0.0000i
- 1.2 lnx表示成log(x),而lgx表示成log10(x)。注意点乘
% a=-3.0:0.1:3; % Z3=@(x)(1/2*(exp(0.3*x)-exp(-0.3*x)*sin(x+3))+log(x+0.3)); % A=Z2(a)
%方法二 function y=ff(x) y=1/2*(exp(0.3*x)-exp(-0.3*x).*sin(x+3))+log(x+0.3); end
a=-3.0:0.1:3;
m=ff(a)
方法3
a=-3.0:0.1:3.0;
z3=0.5*((exp(0.3*a)-exp(-0.3*a)).*sin(a+0.3))+log(0.5*(0.3+a))
- 2矩阵运算 C8=[A([1,3],:);B^2] 注意为冒号
A=[12 34 -4;34 7 87; 3 65 7]; B=[1 3 -1; 2 0 3;3 -2 7]; C1=A*B C2=A.*B C3=A^3 C4=A.^3 C5=A/B C6=B/A C7=[A,B] C8=[A([1,3],:);B^2] --------------------------------------------- C1 = 68 44 62 309 -72 596 154 -5 241 C2 = 12 102 4 68 0 261 9 -130 49 C3 = 37226 233824 48604 247370 149188 600766 78688 454142 118820 C4 = 1728 39304 -64 39304 343 658503 27 274625 343 C5 = 16.4000 -13.6000 7.6000 35.8000 -76.2000 50.2000 67.0000 -134.0000 68.0000 C6 = 0.1027 -0.0062 -0.0069 0.0617 0.0403 -0.0366 0.0205 0.0855 -0.0507 C7 = 12 34 -4 1 3 -1 34 7 87 2 0 3 3 65 7 3 -2 7
C8 =
12 34 -4
3 65 7
4 5 1
11 0 19
20 -5 40