x=[1,2,3,4,5,6,7,8,9,10];
y=[1.2,3,4,4,5,4.7,5,5.2,6,7.2];
p1=polyfit(x,y,1),plot(p1);
hold on
p3=polyfit(x,y,3),plot(p3);
x2=1:0.1:10;
y1=polyval(p1,x2);
y3=polyval(p3,x2);
plot(x,y,’r*’);
plot(x2,y1,’:k’);
plot(x2,y3);
hold off
p=polyfit(log(x),log(y),1);
plot(p)
hold on
p4=polyfit(x,log(x),1),poly(p4)
p5=polyfit(log(x),y,1),plot(p5)
p6=polyfit(x,1./y,1),plot(p6)
hold off
t=0:0.5:5;
w=[6.00 4.83 3.7 3.15 2.41 1.83 1.49 1.21 0.96 0.73 0.64];
p=polyfit(t,log(w),1);
m=p(1)
b=exp(p(2))
tm=0:0.1:5;
wm=b*exp(m*tm);
plot(t,m,’o’,tm,wm,’-g*’)
z1=3+4i,z2=1+2i,z3=2*exp(i*pi/6),z=z1*z2/z3
z_real=real(z),z_image=imag(z),
z_angle=angle(z),z_length=abs(z)