matlab学习第一天

>> x=linspace(-10,10,50);
>> y=x.^2.*sin(x);
>> plot(x,y,'linewidth',1)
>> plot(x,y,'linewidth',2)

分析:
linspace,分割。把(-1010)分割成50份,赋值给x
y=x^2*sin(x)
画出 x,y在同一坐标系下的图像,线的宽度为2

 

切片图,可以做多维图

>> x=linspace(-2,2,40);
>> y=x;
>> z=x;
>> [x,y,z]=meshgrid(x,y,z);
>> w=x.^2+y.^2+z.^2;
>> slice(x,y,z,w,[-1,0,1],[-1,0,1],[-1,0,1]);
>> colorbar

 

plot3函数进行三维做图,quiver3函数进行抖动:

>> t=0:0.1:1.5;
>> Vx=2*t;
>> Vy=2*t.^2;
>> Vz=6*t.^3-t.^2;
>> x=t.^2;
>> y=(2/3)*t.^3;
>> z=(6/4)*t.^4-(1/3)*t.^3;
>> plot3(x,y,z,'r.-'),hold on
>> Vx=gradient(x);
>> Vy=gradient(y);
>> Vy=gradient(z);
>> quiver3(x,y,z,Vx,Vy,Vz),grid on

posted @ 2016-12-05 21:11  超级学渣渣  阅读(337)  评论(0编辑  收藏  举报