Clear Filters
Clear Filters

Info

This question is closed. Reopen it to edit or answer.

how to fix error "index exceeds matrix dimension"?" from 60 by 2 matrix I want to calculate perimeter of ABC formed by three anchor nodes in WSN.I got error message 'index exceeds matrix dimension' .

1 view (last 30 days)
function perim = perimeter(AB,AC,BC) perim = AB+AC+BC;
if neighboring_anchor_n>=3
gridmap=zeros(row_n,col_n);
grid_covered_flag=zeros(row_n,col_n);
perim =sqrt(transpose((neighboring_anchor_n(1,1)-neighboring_anchor_n(2,1)).^2+(neighboring_anchor_n(1,2)-neighboring_anchor_n(2,2)).^2)+sqrt(transpose((neighboring_anchor_n(1,1)-neighboring_anchor_n(3,1)).^2+(neighboring_anchor_n(1,2)-neighboring_anchor_n(3,2)).^2)+sqrt(transpose((neighboring_anchor_n(2,1)-neighboring_anchor_n(3,1)).^2+(neighboring_anchor_n(2,2)-neighboring_anchor_n(3,2)).^2);
end
end

Answers (0)

This question is closed.

Tags

Community Treasure Hunt

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

Start Hunting!