MATLAB 数值计算练习代码

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)

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值