Mathematica 中磁盘像素的协方差矩阵

发布于 2024-12-23 12:05:54 字数 598 浏览 3 评论 0原文

我想计算下图的协方差矩阵。基于像素。即将圆盘的每个黑色像素视为向量。

虽然下面的单位是厘米,但我使用的屏幕上每厘米有 32 个像素。

在协方差矩阵计算本身之前,我无法找出获取所有像素向量的方法。

在此处输入图像描述

frmXY = {{6.59, 1.59}, {33.41, 28.41}};

stim = {{10.85, 21.91, 0.97}, {16.8, 5.26, 0.97}, {11.78, 7.11, 0.97}, 
        {12.64, 14.13, 0.97`}, {20.24, 16.16, 0.97}, {29.51, 8.06,1.53}, 
        {22.42, 5.78, 1.53}, {27.13, 16.47, 1.53}}


Graphics[{EdgeForm[Thick],White, Rectangle @@ frmXY, Black,
          Disk @@@ (stim /. {a_, b_, c_} :> {{a, b}, c})}, ImageSize -> 300]

I would like to compute the Covariance Matrix of the image below. Pixel based. That is considering each Black Pixel of the Disks as vectors.

While the units below are in centimeter, there are 32 pixels per cm on the screen I am using.

Ahead of the Covariance Matrix computation itself, I can`t figure out the way to obtain all the pixels vector.

enter image description here

frmXY = {{6.59, 1.59}, {33.41, 28.41}};

stim = {{10.85, 21.91, 0.97}, {16.8, 5.26, 0.97}, {11.78, 7.11, 0.97}, 
        {12.64, 14.13, 0.97`}, {20.24, 16.16, 0.97}, {29.51, 8.06,1.53}, 
        {22.42, 5.78, 1.53}, {27.13, 16.47, 1.53}}


Graphics[{EdgeForm[Thick],White, Rectangle @@ frmXY, Black,
          Disk @@@ (stim /. {a_, b_, c_} :> {{a, b}, c})}, ImageSize -> 300]

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

久隐师 2024-12-30 12:05:54

从你的问题中不清楚什么构成了描述你的模型/系统的随机变量,我不明白你想要获取的协方差矩阵是什么。

但是,这里有一个简单的示例,展示了如何获取协方差矩阵并计算特征值和特征向量(基本上,重现您的第一个图)。

list = RandomReal[
   MultinormalDistribution[{0, 0}, {{6, 3}, {3, 3}}], {5000}];
sampleCov = Covariance@list;
{eigValues, eigVectors} = Eigensystem@sampleCov;

Show[ListPlot@list, 
 Graphics[{Red, Arrowheads[0.03], 
   Arrow[{{0, 0}, #}] & /@ (eigValues eigVectors)}]]

在此处输入图像描述

It is not clear from your question as to what constitutes the random variable that describes your model/system and I don't understand what it is that you're trying to take the covariance matrix of.

However, here's a simple example showing how to obtain the covariance matrix and compute the eigenvalues and eigenvectors (basically, reproduce your first plot).

list = RandomReal[
   MultinormalDistribution[{0, 0}, {{6, 3}, {3, 3}}], {5000}];
sampleCov = Covariance@list;
{eigValues, eigVectors} = Eigensystem@sampleCov;

Show[ListPlot@list, 
 Graphics[{Red, Arrowheads[0.03], 
   Arrow[{{0, 0}, #}] & /@ (eigValues eigVectors)}]]

enter image description here

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文