2015-08-23 46 views
0

我有这个行/列向量。如何在matlab中沿y轴绘制列向量数据?

grades = [90, 100, 80, 70, 75, 88, 98, 78, 86, 95, 100, 92, 29, 50]; 
plot(grades); 

在MATLAB中,我想绘制沿着x轴的等级值和沿着y轴的指数(1-14)。通过default,指数沿x轴绘制。如何实现?

回答

1
grades = [90, 100, 80, 70, 75, 88, 98, 78, 86, 95, 100, 92, 29, 50]; 
figure; 
plot(1:length(grades),grades); % Indices along X 
figure; 
plot(grades,1:length(grades)); % Indices along Y 
+0

还在输出没有变化。 – erbal

0

如果你想在Matlab中绘制数据。您必须为您感兴趣的所有轴定义数据集。

在您的情况下,定义x轴数据和y轴数据。

因此,例如,你的Y轴数据会

grades = [90 100 80 70 75 88 98 78 86 95 100 92 29 50]; 

你X的数据,你可以使用下面的。

X = 1:14; 

那么你有以下绘图命令

plot(x,grades)