how to apply pso to formula
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
kyungdoo lee
el 26 de Oct. de 2021
Comentada: Star Strider
el 26 de Oct. de 2021
i want to apply pso to function y = -0.0429x4 + 1.1527x3 - 11.178x2 + 43.153x + 19.63
0 comentarios
Respuesta aceptada
Star Strider
el 26 de Oct. de 2021
The parameters have to be elements of a vector (and the appropriate operators must be provided, in this instance multiplication) —
y = @(x) -0.0429*x(4) + 1.1527*x(3) - 11.178*x(2) + 43.153*x(1) + 19.63
If the posted equation is actually something different, (such that ‘x4’ is actually ) those details — and a clear explanation of the actual problem — need to be provided. See the documentation on Anonymous Functions for details on them.
.
2 comentarios
Star Strider
el 26 de Oct. de 2021
If the parameters to be optimised are ‘x’, they must be elements of a vector.
That is how the optimisation functions work.
Also, it is necessary to be clear about the objective of the optimisation.
For example —
y = @(x) -0.0429*x(4) + 1.1527*x(3) - 11.178*x(2) + 43.153*x(1) + 19.63;
x0 = rand(4,1);
[xe1,fval] = fminsearch(y, x0) % Absolute Minimum
fprintf('%23.15E\n',xe1)
[xe2,fval] = fminsearch(@(x)norm(y(x)), x0) % Mean Square Minimum
fprintf('%23.15E\n',xe2)
Experiment to get the desired result.
.
Más respuestas (0)
Ver también
Categorías
Más información sobre Particle Swarm en Help Center y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!