mesh or surf from x y z coordinates
Show older comments
I'm not experienced at all with meshes or 3d plotting, please be patient.
I have a firefly algorithm that optimizes pid paramters given a transfer function.
I would like to visualize how the swarm moves through the iterations, i tried with scatter3 and it works decently still i would prefer a better visualization so i'm trying to understand if surf and/or mesh are viable options.
The output data of the swarm is in the swarm.mat file, basically a nested cell array where the each cell represents a firefly has 2 nested cells, one with coordinates (the 3 pid parameters) and one with fitness evaluation:
{1×2 cell} -> {[35.3854 38.5853 45.3113]} {[0.0910]}
i would like to create a mesh out of the coordinates, first statically from the .mat i'm sharing, then i'll loop it on my own for each iteration creating a gif (already did it with the scatter version).
Is creating a mesh something doable with the data i have? if so, i would really appreciated some hints.
Accepted Answer
More Answers (1)
Maybe something like this:
load swarm
data = vertcat(f{:});
data = cell2mat(data(:,1))
I = scatteredInterpolant(data(:,[1 2]),data(:,3));
[pid1,pid2] = meshgrid(unique(data(:,1)),unique(data(:,2)));
surf(pid1,pid2,I(pid1,pid2))
Categories
Find more on Particle Swarm in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
