首页 > 解决方案 > 计算python中CARTHE漂移器集的相对离散度

问题描述

我正在尝试计算 CARTHE 漂移组的相对分散度;这是作为时间函数的平均对间隔距离的平方,然后在 python 中将色散绘制为时间的函数。D(t) = sqrt(平均(d^2(t)))

我认为编码公式 D(t) 运行正确,但我不能确定我的输出是否正确。我似乎也无法将 D(t) 和距离绘制在同一个数字上。这是当前代码:

import matplotlib.pyplot as plt
import math
import statistics

def Main():
    distance = [1.1725e+05, 1.8653e+05, 4.2449e+05, 8.7399e+05] # ID281 ID496, red
    time = [5, 10, 20, 40]
    
    dt = math.sqrt( statistics.mean(distance) ** (2*(statistics.mean(time))) ) # D(t)=sqrt(mean(d^2(t)))
    print(dt)
    
    plt.plot(distance, time, color='red', markersize=22)
    plt.plot(dt, time,'--', color='red', markersize=20)
    plt.rc('xtick', labelsize=30)
    plt.rc('ytick', labelsize=30)
    plt.xlabel("distance (m)", fontsize=46)
    plt.ylabel("days", fontsize=46)
    plt.title("Seperation Distance Between Drifters Pairs", fontsize=52)
    
    plt.show()

标签: python

解决方案


推荐阅读