creating point graph problem

1 回表示 (過去 30 日間)
tevzia
tevzia 2013 年 10 月 25 日
コメント済み: Walter Roberson 2013 年 10 月 28 日
Hi, I have two different matrices and I try to create point graph with those matrices.
I use:
plot(x,y,'*')
but x and y has 100 value in it when i create plot(x) and plot(y) its a line graph and includes 100 value. when i combine them point graph only shows 10. How could i fix it or add range for the plot

回答 (1 件)

Walter Roberson
Walter Roberson 2013 年 10 月 25 日
It could be that you only have 10 distinguishable pairs.
See what you get if you use
unique([x(:),y(:)], 'rows')
  11 件のコメント
tevzia
tevzia 2013 年 10 月 27 日
all of the length is 10. code is
x = load('hadi.dat');
y = load('yok.dat');
figure
plot(x,y,'*')
set(gcf,'numbertitle','off','name','NPV')
Walter Roberson
Walter Roberson 2013 年 10 月 28 日
Let's go back to my earlier question
Okay, so if I give you the xy pairs x = [3 3 5], y = [1 1 2], then how many points would you expect to see plotted by plot(x, y, '*') ?
you answered (correctly) that there are only 2 unique points so only 2 values would be plotted.
Now, if you were to use
plot(x)
or
plot(y)
you would see 3 points plotted on each. So why did you not get 3 points out of plot(x,y) ?
With your data, you are doing the same thing: you are seeing 100 different points for plot(x) and plot(y), and from that you are expecting that plot(x,y) would show 100 points -- but just like with the simple example, only some of the point-pairs are unique, so you only see the unique combinations.
I am not sure what you are expecting on your output. Are you expecting a sort of grid plot with one point at the combination of each unique x with each unique y ?

サインインしてコメントする。

カテゴリ

Help Center および File Exchange2-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