matlab实验6
1.
a=randn(10,5)+10;
ma=max(max(a))
mi=min(min(a))
s=sum(a,2) sa=sum(sum(a))
P=sort(a)
p1=sort(-a,2)
2.
n=(1:10).^2;
f=sqrt(n);
interp1(n,f,(1:100),'cubic')
3.
n=6:2:18;
f1=[18 20 22 25 30 28 24];
f2=[15 19 24 28 34 32 30];
r=6.5:2:17.5;
w=interp1(n,f1,r,'spline');
w1=interp1(n,f2,r,'spline');
subplot(211),plot(r,w)
subplot(212),plot(r,w1)
4.
x=linspace(1,101,10);
y=log(x)/log(10);
p=polyfit(x,y,5)
y1=polyval(p,x)
plot(x,y,':o',x,y1,'-*')
legend('sin(x)','fit')
5.
p1=[12405];
p2=[00012];
p3=[00123];
p=p1+p2+p3
r=roots(p)
a=[-1 1.2 -1.4; 0.75 2 3.5; 0 5 2.5];
s=polyval(p,a)
6.
f=inline('sqrt(x.^2+1)');
x=1:3;
dx=diff(f([x,4]))/1
7.
I1=inline('sqrt((cos(t)).^2+4*sin(2*t).^2+1)','t');
quad(I1,0,2*pi) I2=inline('log(1+x)./(1+x.^2)','x');
quad(I2,0,1)
浙公网安备 33010602011771号