Educoder中MATLAB数值计算与符号计算

第1关:数据处理

a=[20 5 7 19 23 14 25 67 23 12];
%%%%%%%%% Begin %%%%%%%%
smax=max(a);
smin=min(a);
smean=mean(a);
smedian=median(a);
ssum=sum(a);
%%%%%%%%% End %%%%%%%%%
m=[smax;smin;smean;smedian;ssum];
disp(m);

第2关:多项式计算与数值微积分

a=[4 3 2 5 5];
b=[1 7 4 9 7];
%%%%%%%%% Begin %%%%%%%%%
sconv=conv(a,b);
[sdeconv,e]=deconv(a,b);
spolyder=polyder(a,b);%求导
sdiff=diff(a,2);
%%%%%%%%% End %%%%%%%%%
run './task2/test22'

第3关:线性方程组求解

a=[3,2,2,1;8,-5,0,2;0,3,8,-4;1,6,2,-3];
b=[9,3,9,9]';
%%%%%%%%% Begin %%%%%%%%%
x=a\b;
[l,u]=lu(a);
lux=u\(l\b);
%%%%%%%%% End %%%%%%%%%
run ./task3/test23.m

第4关:符号计算基础

warning('off','all');
pkg load symbolic
syms a b c d
%%%%%%%%% Begin %%%%%%%%%
x=a.^2+b.^2+c.^2+d.^2;
m=a.^3-2*b.^4+c.^2-d.^2;
y=x.*m;
yfactor=factor(y);
yexpand=expand(y);
ysimplify=simplify(y);
%%%%%%%%% End %%%%%%%%%
run ./task4/test24.m

你可能感兴趣的:(matlab,开发语言)