Could anyone help me to solve the issue

3 vues (au cours des 30 derniers jours)
Prabha Kumaresan
Prabha Kumaresan le 14 Août 2018
Modifié(e) : Stephen23 le 15 Août 2018
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.
  3 commentaires
Prabha Kumaresan
Prabha Kumaresan le 14 Août 2018
Modifié(e) : Stephen23 le 14 Août 2018
When i run the code i am getting the following data in the command window which i need to plot in the graph
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
one =
1.0e+13 *
0.6404
2.0818
But in the graph i am getting the plot for one and low datas.But the datas for two,three and four doesnot appear on the graph.Please help me on this.
Stephen23
Stephen23 le 14 Août 2018
Modifié(e) : Stephen23 le 14 Août 2018
"But in the graph i am getting the plot for one and low datas.But the datas for two,three and four doesnot appear on the graph."
Actually all of your data is present and correct. You just forgot to look at your data.

Connectez-vous pour commenter.

Réponses (1)

Stephen23
Stephen23 le 14 Août 2018
Modifié(e) : Stephen23 le 15 Août 2018
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.

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by