前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >Math-Model(二)-无向图最近邻路径搜索

Math-Model(二)-无向图最近邻路径搜索

作者头像
Pulsar-V
发布2019-03-12 17:00:02
2870
发布2019-03-12 17:00:02
举报
文章被收录于专栏:Pulsar-V
代码语言:javascript
复制
%a=xlsread('../附件一:已结束项目任务数据.xls');
clc
clear
GPS_1=importdata('../GPS_DATA.txt');
GPS_2=importdata('../GPS_DATA2.txt');
%X=min([min(GPS_1(:,1)),min(GPS_2(:,1))]):0.01:max([max(GPS_1(:,1)),max(GPS_2(:,1))]);
%Y=min([min(GPS_1(:,2)),min(GPS_2(:,2))]):0.01:max([max(GPS_1(:,2)),max(GPS_2(:,2))]);
figure(1)
plot(GPS_1(:,2),GPS_1(:,1),'*r')%,GPS_2(:,2),GPS_2(:,1),'*b')
figure(2)
plot(GPS_2(:,2),GPS_2(:,1),'*b')
figure(3)
plot(GPS_1(:,2),GPS_1(:,1),'*r',GPS_2(:,2),GPS_2(:,1),'*b')
%插入人员密度值
%Z=griddata(x,y,z,X,Y,'v4');
%%
for i=1:length(GPS_1)
    counter=1;
    counter_task=1;
    gps_point=[0 0 0 0];
    real_distance_list=[0];
    for j=1:length(GPS_2)
        real_distance=eular_distance(GPS_1(i,2),GPS_1(i,1),GPS_2(j,2),GPS_2(j,1));
        if real_distance<12
            gps_point(counter,1)=GPS_2(j,2);
            gps_point(counter,2)=GPS_2(j,1);
            gps_point(counter,3)=GPS_2(j,3);
            gps_point(counter,4)=GPS_2(j,4);
            counter=counter+1;
        end
        real_distance_list(j,1)=real_distance;
    end
    neighbor_counter(i,1)=counter;
    neighbor_limit_mean(i,1)=mean(gps_point(:,3));
    neighbor_reputation_mean(i,1)=mean(gps_point(:,4));
     for j=1:length(GPS_1)
        real_distance=eular_distance(GPS_1(i,2),GPS_1(i,1),GPS_1(j,2),GPS_1(j,1));
        if real_distance<12
            counter_task=counter_task+1;
        end
     end
    neighbor_task_counter(i,1)=counter_task;
    min_distance(i,1)=min(real_distance_list);
end
tabel=[neighbor_counter,neighbor_limit_mean,neighbor_reputation_mean,min_distance,neighbor_task_counter]
%%
plot([1:length(GPS_1)],neighbor_counter,'b')
%%
function real_distance=eular_distance(longitude1,Latitude1,longitude2,Latitude2)
real_distance=distance([Latitude1,longitude1],[Latitude2,longitude2])/180*pi*6371.393;
end
本文参与 腾讯云自媒体同步曝光计划,分享自作者个人站点/博客。
如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体同步曝光计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档