problem in matlab code
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Hello,
Please how i can solve this problem in my Matlab code:
In an assignment A(:) = B, the number of elements in A and B must be the same.
Error in ObjectiveFunction (line 73)
throughputCR(i)= throughputCR(i)+W*log2(1+ SinrCR(i,j));
Error in PSO (line 94)
Swarm.Particles(k).O = fobj(currentX);
Error in main (line 54)
[ GBEST , cgcurve ] = PSO( noPa , maxItera , visFlaga ) ;
>>
0 comentarios
Respuestas (2)
Image Analyst
el 4 de Ag. de 2019
W is probably a vector and so the entire right hand side is a vector. You can't stuff, say, 100 elements into throughputCR(i) which is just a single element.
If you put these lines before the bad line, what does it report in the command window?
whos throughputCR
whos W
whos SinrCR
3 comentarios
Guillaume
el 5 de Ag. de 2019
The problem is still the same, population.Chromosomes(indx(1)).fitness is a vector, a matrix, or is empty. I.E: it's not just one element. And you try to assign it to a single element of a variable.
Image Analyst
el 5 de Ag. de 2019
brahmi, why did you not put in the whos statements like I specifically asked you for? You're just delaying an answer by not doing the things we suggest.
KALYAN ACHARJYA
el 4 de Ag. de 2019
A= B;
7 comentarios
Walter Roberson
el 6 de Ag. de 2019
global W;
You do not show us where you initialized W. W might be its default value for a global variable, which is to say it might be empty.
Ver también
Categorías
Más información sobre Particle Swarm en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!