How can I draw a graph from a given data in MATLAB
8 ビュー (過去 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?
0 件のコメント
採用された回答
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 件のコメント
その他の回答 (0 件)
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!