index exceed matrix dimensions

22 ビュー (過去 30 日間)
Hassan Al-Khateeb
Hassan Al-Khateeb 2018 年 4 月 7 日
コメント済み: Walter Roberson 2018 年 4 月 12 日
for k = 1 : nodes
schedule(k , 1) = x(k);
c = 1;
while((schedule(k , 1 + c) < schedule(k , c)) || (schedule(k , 1 + c) - schedule(k , c) < transmission)) %%%<<<index exceed matrix dimensions .
schedule(k , 1 + c) = schedule(k , c) + transmission; %Delay the next packet, update the schedule.
c = c + 1;
end
end

回答 (4 件)

Walter Roberson
Walter Roberson 2018 年 4 月 7 日
What happens if you get to the right hand side but the conditions are still true?
We are not given any information about what transmission is.
If transmission is negative then
schedule(k , 1 + c) = schedule(k , c) + transmission
will continue to be < schedule(k , c)
If transmission is non-integer then you run the risk that after
schedule(k , 1 + c) = schedule(k , c) + transmission
then on the next round with increased c, that
schedule(k , 1 + c) - schedule(k , c) < transmission
is true. Algebraically it should not be -- algebraically it should equal transmission rather being less than transmission, but because of floating point round-off it can be less.
  2 件のコメント
Hassan Al-Khateeb
Hassan Al-Khateeb 2018 年 4 月 8 日
編集済み: Walter Roberson 2018 年 4 月 11 日
Thank you very much Mr.Walter Roberson , but, the same error message still appears every time and this error appear only if i exceed the generation_freq to more than 59((in the general file))
Index exceeds matrix dimensions.
Error in csma_phase (line 114)
while (schedule(k , 1 + c) - schedule(k , c) < transmission)
Error in proposed_mac (line 61)
[delay , energy , ~ , packets_received , cluster_end] = csma_phase(traffic((1 + c1 + c2):(phase_node(pc) + c1 + c2) , :) , Tx_node((1 + c1 +
c3):(phase_node(pc) + c1 + c3)) , frame_duration , phase_duration , phase_duration * (pc-1) , pc , phase);
Error in main (line 102)
[delay1 , energy1 , throughput1 , ~ , bl_CH , bl_cm] = proposed_mac(traffic , Tx_nc , Tx_CH , Tx_node , clusters);
Yours,
Walter Roberson
Walter Roberson 2018 年 4 月 8 日
The code your provided in general.m is missing end statements and possibly other statements as well.

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


Hassan Al-Khateeb
Hassan Al-Khateeb 2018 年 4 月 9 日
編集済み: Walter Roberson 2018 年 4 月 9 日
Dear Mr. Roberson,
Yes, I agree with you ..... the attached file above is the complete code .... Thanks
  1 件のコメント
Walter Roberson
Walter Roberson 2018 年 4 月 9 日
Undefined function or variable 'clustering'.
Error in general (line 92)
[CH_I , Tx_CH , Tx_node , CM_I , clusters] = clustering(nodes_location , Tx , threshold);

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


Hassan Al-Khateeb
Hassan Al-Khateeb 2018 年 4 月 11 日
  1 件のコメント
Walter Roberson
Walter Roberson 2018 年 4 月 11 日
Undefined function or variable 'proposed_mac'.
Error in general (line 102)
[delay1 , energy1 , throughput1 , ~ , bl_CH , bl_cm] = proposed_mac(traffic , Tx_nc , Tx_CH , Tx_node , clusters);

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


Hassan Al-Khateeb
Hassan Al-Khateeb 2018 年 4 月 12 日
編集済み: Walter Roberson 2018 年 4 月 12 日
Greetings,
The attached file is the proposed mac.
Thanks
  2 件のコメント
Walter Roberson
Walter Roberson 2018 年 4 月 12 日
Line 215 of csma_phase.m contains
else .
which is invalid. You need to remove the "."
Your code in proposed_mac.m defines 6 output arguments
delay_c , energy_c , throughput_c, packets_received_c , bl_CH , bl_cm
but it does not assign to any of them and does not even mention any of them other than in the function line.
Walter Roberson
Walter Roberson 2018 年 4 月 12 日
Note: please do not keep adding Answers. To make a response, click on one of the lines that say "Comment on this Answer" and it will expand to a text entry area.

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

カテゴリ

Help Center および File ExchangeCreating and Concatenating Matrices についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by