【问题标题】:How can I make a matrix average calculator in Scilab?如何在 Scilab 中制作矩阵平均值计算器?
【发布时间】:2013-10-28 14:47:27
【问题描述】:

我想在 scilab 中制作一个不重叠的 3D 矩阵,并用一个 NxNxN 大小的立方体循环遍历它,将立方体中体素的平均值分配给中心体素。

转到第 2 页,看看我需要什么。 https://drive.google.com/file/d/0B5wCiQEnPJYZdGxCcmRBc0NHNGc/edit?usp=sharing

非常感谢您。

附:不用担心无效的平均音量问题。矩阵可以只是 100x100x100 或类似的。

【问题讨论】:

    标签: matlab math matrix average scilab


    【解决方案1】:

    您描述的问题与您发布的论文不同。我按照您的描述进行了操作,但将其拆分为多行,以便您轻松适应您的要求。

    它与the MatLab answer 某人在您的其他问题中发布的非常相似。我不知道其他答案中使用的与 SciLab 中的 mat2cellcellfun 类似的任何内容。

    clear; clc
    
    K = 100
    N = 5
    
    mid = floor(N/2)
    
    volume = rand(K, K, K)
    cubeCount = floor( K / N )
    
    for x=0:cubeCount-1
        for y=0:cubeCount-1
            for z=0:cubeCount-1
    
                // Get a cube of NxNxN size  
                cube = volume((1:N)+N*x, (1:N)+N*y, (1:N)+N*z);
    
                //Calculate the average value of the voxels in the cube
                avg = sum( cube ) / (N * N * N);
    
                // Assign it to the center voxel
                volume( N*x+mid+1, N*y+mid+1, N*z+mid+1 ) = avg
            end
         end
     end
    
    disp( volume )
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2019-04-22
      • 1970-01-01
      • 2013-01-04
      • 2014-01-21
      • 2011-04-23
      • 2022-01-17
      • 1970-01-01
      相关资源
      最近更新 更多