数据的可视化绘图(Matlab实现)

    xiaoxiao2021-03-25  81

     1.在区间[-4,4]上绘制函数y=sin x 图形

    代码:

    >> x=-4:0.1:4; >> y=sin(x); >> plot(x,y) >> gird on %显示网格线 输出如图:

    2.绘制三维曲线图像

     根据下列函数绘图:

       | x=t sin t,

       | y=t cos t,   0<=t<=20pi

       | z=t,

    Matlab代码:

    >> t=0:pi/10:20*pi; >> x=t.*sin(t); >> y=t.*cos(t); >> z=t; >> plot3(x,y,z) >>

    输出如图

     3.函数绘图

        ---->一元函数绘图

         代码:

    >> x='3*t*sin(t)'; >> y='t*cos(t)'; >> ezplot(x,y,[0,8*pi]) 输出图形:

     

     ------>二元函数绘图

     代码:

    >> x=0:0.1:5; >> y=-3:0.1:2; >> [X,Y]=meshgrid(x,y); >> Z=X.^3+Y.^3; >> surf(X,Y,Z); >> xlabel('x'),ylabel('y'),zlabel('z'); >> title('z=x^3+y^3') >>

    输出图形:

    转载请注明原文地址: https://ju.6miu.com/read-32748.html

    最新回复(0)