could anyone help me to correct this code. i just need a bit of help.
2 views (last 30 days)
Show older comments
clear all
close all
warning off
load data
x = data.x;
y = data.y;
h = data.h;
h1 = data.h1;
h2 = data.h2;
load net
load net1
% load Training values
org_x = x;
org_y = y;
for ui = 1:length(x)
corr_fact = correction_Factor(ui,x,y,h);
best_dist = euclidean_dist(ui,x,y);
x(ui) = x(ui)+corr_fact;
y(ui) = y(ui)+corr_fact;
h(ui) = h(ui)+corr_fact;
end
[x,y] = Asp_Method(x,y,h);
% ASP Method Result
figure;
plot(org_x,org_y,'o','color','green');
hold on
drawnow
plot(x,y,'+');
grid on
legend('Real Position','Estimated Position');
xlabel('Width of Area');
ylabel('Length of Area');
% NN centralized localization method Result
[Xest,Yest] = NN_centralized(org_x,org_y,h1);
figure;
plot(org_x,org_y,'o','color','green');
hold on
drawnow
plot(Xest(:,1),Yest(:,1),'+');
grid on
legend('Real Position','Estimated Position');
xlabel('Width of Area');
ylabel('Length of Area');
% NN distributed method Result
[Xest1,Yest1] = NN_distributed(org_x,org_y,h2);
figure;
plot(org_x,org_y,'o','color','green');
hold on
drawnow
plot(Xest1(:,1),Yest1(:,1),'+');
grid on
legend('Real Position','Estimated Position');
xlabel('Width of Area');
ylabel('Length of Area');
% Localization error: Performnce result Graphs
asp_error = Localization_error(org_x,org_y,x,y);
figure
bar(asp_error);
axis([0 21 0 max(asp_error)])
xlabel('Sensor of Nodes');
ylabel('Localization Error');
title('Localization error : ASP method');
cen_error = Localization_error(org_x,org_y,Xest,Yest);
figure
bar(cen_error);
axis([0 21 0 max(cen_error)+0.2])
xlabel('Sensor of Nodes');
ylabel('Localization Error');
title('Localization error : NN centralized method');
dis_error = Localization_error(org_x,org_y,Xest1,Yest1);
figure
bar(dis_error);
axis([0 21 0 max(dis_error)+0.01])
xlabel('Sensor of Nodes');
ylabel('Localization Error');
title('Localization error : NN distributed method');
% calculating Average localization error
avg_error_asp = Average_localization_error(org_x,org_y,x,y);
avg_error_cen = Average_localization_error(org_x,org_y,Xest,Yest);
avg_error_dis = Average_localization_error(org_x,org_y,Xest1,Yest1);
display('------------ASP Method------------');
display(['Average Error :' num2str(avg_error_asp)]);
display(['Minimum Error :' num2str(min(asp_error))]);
display(['Maximum Error :' num2str(max(asp_error))]);
display('----------------------------------');
display('------------NN centralized Method------------');
display(['Average Error :' num2str(avg_error_cen)]);
display(['Minimum Error :' num2str(min(cen_error))]);
display(['Maximum Error :' num2str(max(cen_error))]);
display('----------------------------------');
display('------------NN distributed Method------------');
display(['Average Error :' num2str(avg_error_dis)]);
display(['Minimum Error :' num2str(min(dis_error))]);
display(['Maximum Error :' num2str(max(dis_error))]);
display('----------------------------------');
end
end
- inserting anchor nodes in both asp and neural network methods
- correction factor uses anchor node as input.
- training in neural network uses original location..that is input and output are same..
4 Comments
Answers (0)
See Also
Categories
Find more on Sequence and Numeric Feature Data Workflows in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!