How can I draw a graph from a given data in MATLAB

9 次查看(过去 30 天)
How one can draw a graph from a given data so that the first column is being taken as x-axis in MATLAB. Here, I want to generate a graph in Matlab from the following data where the first column should be the x-axis (Time must be the x-axis i.e. horizontal).
_
_________________________________________________
Time A B C D
__________________________________________________
1 0.84702 0.64419 0.61728 0.48538
2 0.76445 0.1864 0.39728 0.15959
3 0.04743 0.0412 0.09432 0.86721
4 0.4256 0.1458 0.05432 0.803192
5 0.9855 0.8242 0.5679 0.7102
___________________________________________________
So far I tried the following, first I saved this data file as 'myData.m'. Next, I load it on my Matlab window using the command 'load myData.m'. Then after, I have used the followig codes:
[n,p] = size(myData);
t = 1:n;
plot(t,myData)
But, it doesn't give me what I want. Please help?

采纳的回答

Walter Roberson
Walter Roberson 2017-5-9
myData = [ 1 0.84702 0.64419 0.61728 0.48538
2 0.76445 0.1864 0.39728 0.15959
3 0.04743 0.0412 0.09432 0.86721
4 0.4256 0.1458 0.05432 0.803192
5 0.9855 0.8242 0.5679 0.7102]
plot(myData(:,1), myData(:,2:end))

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 2-D and 3-D Plots 的更多信息

标签

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by