zoukankan      html  css  js  c++  java
  • 《高等应用数学问题的MATLAB求解》——第8章习题代码

    (1)

    >> t=0:0.12:1;y=t.^2*exp(-5*t).*sin(t);
    >> t1=0:0.02:1;y0=t1.^2.*exp(-5*t1).*sin(t1);y1=interp1(t,y,t1,'spline');
    >> plot(t1,y1,':',t,y,'o',t1,y0)
    

    (2)

    >> t=0:0.12:3;y=sin(10*t.^2+3);
    >> t1=0:0.02:3;y0=sin(10*t1.^2+3);y1=interp1(t,y,t1,'spline');
    >> plot(t1,y1,':',t,y,'o',t1,y0)
    

    结果

    (3)

    >> [x,y]=meshgrid(-2:.4:2,-2:.4:2);
    >> z=exp(-x.^2-y.^4).*sin(x.*y.^2+x.^2.*y)./(3*x.^3+y);
    >> surf(x,y,z),axis([-2,2,-2,2,-0.3,0.3]);
    >> [x1 y1]=meshgrid(-2:.1:2,-2:.1:2);
    >>  z1=interp2(x,y,z,x1,y1,'spline');figure;surf(x1,y1,z1),axis([-2,2,-2,2,-0.3,0.3]);
    >> z0=exp(-x1.^2-y1.^4).*sin(x1.*y1.^2+x1.^2.*y1)./(3*x1.^3+y1);
    >> figure;surf(x1,y1,z1-z0)
    

    结果

    (4)

    >> x=-2:0.3:4.9;y=[0.1029,0.1174,0.1316,0.1448,0.1566,0.1662,0.1733,0.1775,0.1785,0.1764,0.1711,0.1630,0.1526,0.1402,0.1266,0.1122,0.0977,0.0835,0.0702,0.0577,0.0469,0.0373,0.0291,0.0224];
    >> x1=-2:0.02:4.9;y1=interp1(x,y,x1);y2=interp1(x,y,x1,'spline');y3=interp1(x,y,x1,'nearest');y4=interp1(x,y,x1,'pchip');
    >> subplot(2,2,1);plot(x1,y1,x,y,'o');subplot(2,2,2);plot(x1,y2,x,y,'o');subplot(2,2,3);plot(x1,y3,x,y,'o');subplot(2,2,4);plot(x1,y4,x,y,'o')
    

    (5)

  • 相关阅读:
    vue-cli生成的重要代码详解
    vuex初探
    vue-router笔记
    新技术的学习
    图片优化方法(有时间看看)
    关于老教授之家项目的思考 && 中国互联网+大赛培训
    If you are tired...
    微信公众平台开发初探
    winscp介绍与使用
    获取当前服务器信息
  • 原文地址:https://www.cnblogs.com/Math-Nav/p/13375263.html
Copyright © 2011-2022 走看看