cleaned up plotting
This commit is contained in:
@@ -20,25 +20,23 @@ function f = plotParameters(obj)
|
||||
|
||||
% Distance
|
||||
nexttile(1, [1, 1]);
|
||||
grid(f.Children(1).Children(1), "on");
|
||||
title(f.Children(1).Children(1), "Distance Membership Sigmoid");
|
||||
xlabel(f.Children(1).Children(1), "Distance (m)");
|
||||
ylabel(f.Children(1).Children(1), "Membership");
|
||||
hold(f.Children(1).Children(1), 'on');
|
||||
plot(f.Children(1).Children(1), d, d_x, 'LineWidth', 2);
|
||||
hold(f.Children(1).Children(1), 'off');
|
||||
grid("on");
|
||||
title("Distance Membership Sigmoid");
|
||||
xlabel("Distance (m)");
|
||||
ylabel("Membership");
|
||||
hold('on');
|
||||
plot(d, d_x, 'LineWidth', 2);
|
||||
hold('off');
|
||||
ylim([0, 1]);
|
||||
|
||||
% Tilt
|
||||
nexttile(2, [1, 1]);
|
||||
grid(f.Children(1).Children(1), "on");
|
||||
title(f.Children(1).Children(1), "Tilt Membership Sigmoid");
|
||||
xlabel(f.Children(1).Children(1), "Tilt (deg)");
|
||||
ylabel(f.Children(1).Children(1), "Membership");
|
||||
hold(f.Children(1).Children(1), 'on');
|
||||
plot(f.Children(1).Children(1), t, t_x, 'LineWidth', 2);
|
||||
hold(f.Children(1).Children(1), 'off');
|
||||
|
||||
|
||||
keyboard
|
||||
grid("on");
|
||||
title("Tilt Membership Sigmoid");
|
||||
xlabel("Tilt (deg)");
|
||||
ylabel("Membership");
|
||||
hold('on');
|
||||
plot(t, t_x, 'LineWidth', 2);
|
||||
hold('off');
|
||||
ylim([0, 1]);
|
||||
end
|
||||
@@ -13,7 +13,7 @@ classdef sigmoidSensor
|
||||
[obj] = initialize(obj, alphaDist, betaDist, alphaPan, betaPan, alphaTilt, betaTilt);
|
||||
[values, positions] = sense(obj, agent, sensingObjective, domain, partitioning);
|
||||
[value] = sensorPerformance(obj, agentPos, agentPan, agentTilt, targetPos);
|
||||
plotParameters(obj);
|
||||
[f] = plotParameters(obj);
|
||||
end
|
||||
methods (Access = private)
|
||||
x = distanceMembership(obj, d);
|
||||
|
||||
@@ -356,6 +356,7 @@ classdef test_miSim < matlab.unittest.TestCase
|
||||
sensor = sigmoidSensor;
|
||||
% Homogeneous sensor model parameters
|
||||
sensor = sensor.initialize(2.5, 3, NaN, NaN, deg2rad(15), 3);
|
||||
f = sensor.plotParameters();
|
||||
% Heterogeneous sensor model parameters
|
||||
% sensor = sensor.initialize(tc.alphaDistMin + rand * (tc.alphaDistMax - tc.alphaDistMin), tc.betaDistMin + rand * (tc.betaDistMax - tc.betaDistMin), NaN, NaN, tc.alphaTiltMin + rand * (tc.alphaTiltMax - tc.alphaTiltMin), tc.betaTiltMin + rand * (tc.betaTiltMax - tc.betaTiltMin));
|
||||
|
||||
@@ -365,10 +366,10 @@ classdef test_miSim < matlab.unittest.TestCase
|
||||
tc.agents{2} = tc.agents{2}.initialize(tc.domain.center - [d, 0, 0], zeros(1,3), 0, 0, geometry2, sensor, @gradientAscent, 3*d, 2, sprintf("Agent %d", 2));
|
||||
|
||||
% Optional third agent along the +Y axis
|
||||
% geometry3 = rectangularPrism;
|
||||
% geometry3 = geometry3.initialize([tc.domain.center - [0, d, 0] - tc.collisionRanges(1) * ones(1, 3); tc.domain.center - [0, d, 0] + tc.collisionRanges(1) * ones(1, 3)], REGION_TYPE.COLLISION, sprintf("Agent %d collision volume", 3));
|
||||
% tc.agents{3} = agent;
|
||||
% tc.agents{3} = tc.agents{3}.initialize(tc.domain.center - [0, d, 0], zeros(1, 3), 0, 0, geometry3, sensor, @gradientAscent, 3*d, 3, sprintf("Agent %d", 3));
|
||||
geometry3 = rectangularPrism;
|
||||
geometry3 = geometry3.initialize([tc.domain.center - [0, d, 0] - tc.collisionRanges(1) * ones(1, 3); tc.domain.center - [0, d, 0] + tc.collisionRanges(1) * ones(1, 3)], REGION_TYPE.COLLISION, sprintf("Agent %d collision volume", 3));
|
||||
tc.agents{3} = agent;
|
||||
tc.agents{3} = tc.agents{3}.initialize(tc.domain.center - [0, d, 0], zeros(1, 3), 0, 0, geometry3, sensor, @gradientAscent, 3*d, 3, sprintf("Agent %d", 3));
|
||||
|
||||
% Initialize the simulation
|
||||
tc.testClass = tc.testClass.initialize(tc.domain, tc.domain.objective, tc.agents, tc.timestep, tc.partitoningFreq, tc.maxIter);
|
||||
|
||||
Reference in New Issue
Block a user