【发布时间】:2021-09-21 05:24:41
【问题描述】:
我想在 Matlab 中生成随机数以获得良好的分布,但是,我只有一行...
我尝试使用random('HalfNormal',500,500)、random('Binomial',50,rand(1,1)); 和random('Logistic',0,0.1);,但我只得到了这样的结果:
但我需要这样的东西:
我该怎么做?
更新: 我的数据生成器代码,用于数据的第一部分:
R_i = 750;
R_0 = 7500;
t = 0.75;
a = 0.75;
for i = 1:500
R_i = R_i + random('HalfNormal',50,15);
R_0 = R_0 + random('HalfNormal',500,500);
%here is my data
[output] = ComplexChanger(R_i,R_0,t,a,random_complex_dataset);
%from here I can save to file or anything using the mean(abs(real(output))) and mean(abs(imag(output))), so I can generate a number from all of it, which means this is much more randomized
end
function [output] = ComplexChanger(R_i,R_0,t,a, random_complex_dataset)
output = R_i+(R_0-R_i)./(1+(sqrt(-1).*xdata.*t).^a); %here I change the complex data with a basic Cole stuff, which is ideal to manipulate complex number, which are good to have a two dimensional vector.
end
【问题讨论】:
-
请展示你所做的一切。我不明白您是如何从随机数中获得这些图的,除非您将每个值与自身进行对比。见minimal reproducible example。还要解释“一个好的分布”是什么意思。你需要明确你需要什么。我们可以从中提取数以百计的“不错的分布”。我们需要准确了解您的目标,以便在您的路上为您提供帮助。
-
@CrisLuengo 我已经从它们创建了 2D 数组,仅此而已。
-
你一定是从 x 中计算出 y 的。它们显然是相关的。显示您的代码。
-
@CrisLuengo 这有点复杂,生成器是 Matlab 的,绘图仪是 Python 的,但是我已经用生成器部分更新了问题。
-
randn产生正态分布的数据,rand产生均匀分布的数据。您可以在 MATLAB 中进行其他分发,但涉及更多。这两个是简单的基本功能。这些是很好的噪声发生器。如果你为 x 绘制一个随机值,为 y 绘制一个随机值,你将不会得到一条线,这些值将是不相关的。
标签: matlab random distribution scatter-plot