Can anyone help me to spot the error and how to solve it?

5 visualizzazioni (ultimi 30 giorni)
Error in OPT_LEACH (line 279)
plot([r r+1],[STATISTICS(r+1).AVG STATISTICS(r+2).AVG],'red');
Error using plot
Vectors must be the same lengths.
And here is the function of error:
figure(3);
for r=0:1:300
ylabel('Average Energy of each Node');
xlabel('Round Number');
plot([r r+1],[STATISTICS(r+1).AVG STATISTICS(r+2).AVG],'red');
hold on;
end

Risposte (2)

Jan
Jan il 9 Apr 2017
I guess that STATISTICS(r+1).AVG or STATISTICS(r+2).AVG is not a scalar.
  2 Commenti
Ayan Bakshi
Ayan Bakshi il 10 Apr 2017
How to make it scalar or if there is alternative what it is.
Jan
Jan il 12 Apr 2017
@Ayan: I cannot guess what you want to achieve, therefore I cannot suggest any changes.

Accedi per commentare.


utsav kakkad
utsav kakkad il 5 Nov 2018
Hey I am having the same error and using STATISTICS(r+1).avg How did you solve it ?

Categorie

Scopri di più su 2-D and 3-D Plots in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by