フィルターのクリア

Why it dont display all my nodes

2 ビュー (過去 30 日間)
Muhammad Fathullah
Muhammad Fathullah 2014 年 12 月 18 日
コメント済み: Muhammad Fathullah 2014 年 12 月 18 日
function [test] = Test(a,b,c,d)
%UNTITLED2 Summary of this function goes here
% Detailed explanation goes here
a= [8 0 -1 2 4 6 3 10 2.5 -5 7 9 11 13 ];
b = [2 4 6 -1 -2 0.5 0 3.7 1.8 1 0 4 3 2 ];
%a=[8 0 -1 2 4 6 3 8]
%b=[2 4 6 -1 -2 0.5 0 2]
c = hypot(a,b);
d = sum(c);
plot(a,b,'--bs','LineWidth',2 ,'MarkerEdgeColor','b',...
'MarkerFaceColor','g','MarkerSize',10)
for i=1:a
text(a(i)+.5,b(i),['\leftarrow node ',num2str(i)]);
end
title(['Total course by the length of ' num2str(d) ]);
end
I want it to show all my nodes number , but it only get until node 8 , anyone can help?

採用された回答

Orion
Orion 2014 年 12 月 18 日
編集済み: Orion 2014 年 12 月 18 日
the index in your loop has no meaning :
for i = 1:a % this create the vector 1 2 ... 8 because 8 is the 1st value of a
just change it to
for i=1:length(a)
  1 件のコメント
Muhammad Fathullah
Muhammad Fathullah 2014 年 12 月 18 日
Thx for the help , really appreciate it

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

その他の回答 (0 件)

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by