Graph will not display
12 ビュー (過去 30 日間)
古いコメントを表示
the program is still in the early stages, so quite abit of it is commented out. My loop is running through with no errors, but I'm not getting the graph to display. Any thoughts on why would be appreciated. I attached the file below.
0 件のコメント
採用された回答
Walter Roberson
2018 年 1 月 25 日
Change
plot(x2,fx)
to
plot(x2, fx, '*')
3 件のコメント
Walter Roberson
2018 年 1 月 25 日
You have
x2=1:number;
so x2 is a vector.
You have
while x2 < number
Here x2 is a vector. In MATLAB, this test is the same as
while all(x2 < number)
-- the body of the while is only executed if all elements of the vector x2 are < number. But some of them are not.
Perhaps you should be using a for loop instead of a while loop.
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Graph and Network Algorithms についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!