matlab中如何画图
时间: 2024-03-28 08:32:00 浏览: 80
以下是在Matlab中画图的方法:
1.绘制简单的曲线
```matlab
x = 0:pi/100:2*pi;
y = sin(x);
plot(x,y);
```
2.绘制多条曲线
```matlab
x1 = 1:10; y1 = rand(1,10);
x2 = 1:10; y2 = rand(1,10);
plot(x1,y1);
hold on;
plot(x2,y2);
```
3.绘制散点图
```matlab
x = rand(1,50);
y = rand(1,50);
scatter(x,y);
```
4.绘制柱状图
```matlab
x = 1:5;
y = [3 5 2 7 1];
bar(x,y);
```
5.绘制饼图
```matlab
x = [20 30 50];
pie(x);
```
阅读全文