1、繪製連續圖
>> x=[-10:1:10];
>> y=x.^2;
>> plot(x,y)
2、繪製點圖
>> x=[-10:1:10];
>> y=x.^2;
>> plot(x,y,'ro')//r代表紅色
>> plot(x,y,'p')//p代表是五角星
3、繪製點線圖
>> x=[-10:1:10];
>> y=x.^2;
>> plot(x,y,'b--o')//b代表藍色
4、繪製多條曲線
>> x=[-10:1:10];
>> y=x.^2;
>> plot(x,y)
>>hold on//保持原先的圖形
>>y1=sin(x);
>>plot(x,y1);
5、關閉圖形窗口
>> close all
6、修改曲線的線寬
>> plot(x,y,'LineWidth',5)
7、給圖形加標題和標籤
>> title('標題')
>> xlabel('單位(k/km)')
>> ylabel('單位(k/km)')
8、添加圖例值
>> legend('x^2','sin(x)')
9、畫2*2的圖
>>x=-4:0.1:4;
>>y1 = sin(x);
>>y2 = sin(2.*x);
>>y3 = sin(3.*x);
>>y4 = sin(4.*x);
>>subplot(2,2,1);
>>plot(x,y1);
>>title('y=sin(x)');
>>subplot(2,2,2);
>>plot(x,y2);
>>title('y=sin(2x)');
>>subplot(2,2,3);
>>plot(x,y3);
>>title('y=sin(3x)');
>>subplot(2,2,4);
>>plot(x,y4);
>>title('y=sin(4x)');
10、畫2*1的圖
>>x=-4:0.1:4;
>>y1 = sin(x);
>>y2 = sin(2.*x);
>>y3 = sin(3.*x);
>>y4 = sin(4.*x);
>>subplot(2,2,1);
>>plot(x,y1);
>>title('y=sin(x)');
>>subplot(2,2,2);
>>plot(x,y2);
>>title('y=sin(2x)');
>>subplot(2,2,(3:4));//與上面不一樣就是這不同,把3和4合併了
>>plot(x,y4);
>>title('y=sin(4x)');
11、繪製極座標圖形
繪製y=sin2tcos2t
>> t=0:0.01:2*pi;
>> polar(t,sin(2*t).*cos(2*t));