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!