Could anyone help me to solve the issue
3 ビュー (過去 30 日間)
古いコメントを表示
I want to plot single graph by using the following command figure;
plot(A,one,'-bs');hold on;
plot(A,four,'-cs');hold on;
plot(A,three,'-ys');hold on;
plot(A,two,'-rs');hold on;
plot(A,low,'-ms');hold on;
when i run the code the figure gives me the plot of one and low but not four,three,and two. could anyone please help me on this.
回答 (1 件)
Stephen23
2018 年 8 月 14 日
編集済み: Stephen23
2018 年 8 月 15 日
You need to actually look at the data that you are plotting: what magnitude do they have? Your data are of order 1e13, 1e9, and 1e7, depending on which variable. Do you really expect to see differences between 1e9 and 1e7 data, when plotted on a linear scale together with 1e13 data? Think about it: data of order 1e13 are ten thousand times larger than data of order 1e9, and one million times larger than 1e7 data. The difference between the 1e13 data and the 1e9 data is going to be hundreds of times larger than the difference between the 1e9 and 1e7 data. How many pixels do the axes use? Unless you are plotting your data on a football field, you are simply not going to notice any difference between the 1e9 and 1e7 data.
If you want to see the 1e13, 1e9, and 1e7 data on one axes then you will have to use a logarithmic y-axes, such as with semilogy. It worked for me:
X = [0;1];
one = 1.0e+13 * [0.6404;2.0818]
two = 1.0e+09 * [4.4050;5.3191]
three = 1.0e+09 * [0.7334;1.8085]
four = 1.0e+09 * [0.9622;2.7479]
low = 1.0e+07 * [0.8118;4.9645]
mat = [one,two,three,four,low]; % much better than using a loop.
figure()
plot(X,mat)
title('PLOT: no way to distinguish 1e7 and 1e9')
figure()
semilogy(X,mat)
title('SEMILOGY: aaaah, much better')
giving these two plots:
PS: variable names one, two, etc. are not a good sign. You should probably be using indexing.
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Annotations についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!