【问题标题】:How do I make these matrix sizes the same?如何使这些矩阵大小相同?
【发布时间】:2020-10-03 19:55:31
【问题描述】:

我有 1x252 矩阵和 13x252 矩阵。我需要使它们匹配,以便我可以使用 corrcoef 找到相关系数。不完全确定如何使用该函数,并且我有一段时间没有做过很多matlab。

【问题讨论】:

    标签: matlab matrix size correlation coefficients


    【解决方案1】:

    如果没有关于如何在矩阵中配置数据的更多详细信息,这就是我想出的。在本例中,该脚本使用repmat() 函数重复/复制Matrix_1 的行。

    %Random data sets%
    Matrix_1 = rand(1,252);
    Matrix_2 = rand(13,252);
    
    %Repeating the rows of x to match the number of rows in y%
    Matrix_1 = repmat(Matrix_1,13,1);
    
    
    Correlation_Coefficients = corrcoef(Matrix_1,Matrix_2);
    Correlation_Coefficients
    

    使用 MATLAB 版本:R2019b

    【讨论】:

      猜你喜欢
      • 2016-03-08
      • 2022-11-12
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多