m0_51205714 2024-10-14 23:43 采纳率: 0%
浏览 3

信息论;校验矩阵;生成矩阵(相关搜索:信息论)

为什么直接算不出来P,算出来都是0?
其实都是matlab

clc
clear
close all
% 一、构造校验矩阵 H 和生成矩阵 G
% 1. 构造校验矩阵 H
H = [0 0 0 1 1 1 1;
        0 1 1 0 0 1 1;
        1 0 1 0 1 0 1];
% 2. 构造生成矩阵 G
% 通过 H 和单位矩阵的关系求解 P
syms k1 k2 k3 k4 k5 k6 k7 k8 k9 k10 k11 k12
assume(k1 == 0 | k1 == 1);
assume(k2 == 0 | k2 == 1);
assume(k3 == 0 | k3 == 1);
assume(k4 == 0 | k4 == 1);
assume(k5 == 0 | k5 == 1);
assume(k6 == 0 | k6 == 1);
assume(k7 == 0 | k7 == 1);
assume(k8 == 0 | k8 == 1);
assume(k9 == 0 | k9 == 1);
assume(k10 == 0 | k10 == 1);
assume(k11 == 0 | k11 == 1);
assume(k12 == 0 | k12 == 1);
P=zeros(4,3);
P = [k1 k2 k3;
     k4 k5 k6;
     k7 k8 k9;
     k10 k11 k12];
 I = eye(4);
G = [I P]; % 使用 P 的转置与 I 拼接
Z=zeros(4,3);
eqns1 = [G*H'==Z];
S1 = solve(eqns1, [k1 k2 k3 k4 k5 k6 k7 k8 k9 k10 k11 k12]);
P=[S1.k1 S1.k2 S1.k3;
    S1.k4 S1.k5 S1.k6;
    S1.k7 S1.k8 S1.k9;
     S1.k10 S1.k11 S1.k12];


  • 写回答

1条回答 默认 最新

  • Java Fans 全栈领域优质创作者 2024-10-15 10:39
    关注

    帮你修改了下,你试试看:(如若有用,还请题主采纳!)

    clc
    clear
    close all
    
    % 一、构造校验矩阵 H 和生成矩阵 G
    % 1. 构造校验矩阵 H
    H = [0 0 0 1 1 1 1;
            0 1 1 0 0 1 1;
            1 0 1 0 1 0 1];
    
    % 2. 构造生成矩阵 G
    syms k1 k2 k3 k4 k5 k6 k7 k8 k9 k10 k11 k12
    assume(k1 == 0 | k1 == 1);
    assume(k2 == 0 | k2 == 1);
    assume(k3 == 0 | k3 == 1);
    assume(k4 == 0 | k4 == 1);
    assume(k5 == 0 | k5 == 1);
    assume(k6 == 0 | k6 == 1);
    assume(k7 == 0 | k7 == 1);
    assume(k8 == 0 | k8 == 1);
    assume(k9 == 0 | k9 == 1);
    assume(k10 == 0 | k10 == 1);
    assume(k11 == 0 | k11 == 1);
    assume(k12 == 0 | k12 == 1);
    
    P = [k1 k2 k3;
         k4 k5 k6;
         k7 k8 k9;
         k10 k11 k12];
    
    I = eye(4);
    G = [I P];
    
    % 解方程组求解 P
    syms p1 p2 p3 p4 p5 p6 p7 p8 p9 p10 p11 p12
    eqns = G * H' == zeros(4, 3);
    S = solve(eqns, [k1 k2 k3 k4 k5 k6 k7 k8 k9 k10 k11 k12]);
    
    P = [S.k1 S.k2 S.k3;
         S.k4 S.k5 S.k6;
         S.k7 S.k8 S.k9;
         S.k10 S.k11 S.k12];
    
    
    
    
    评论

报告相同问题?

问题事件

  • 创建了问题 10月14日

悬赏问题

  • ¥15 有两个非常“自以为是”烦人的问题急期待大家解决!
  • ¥30 STM32 INMP441无法读取数据
  • ¥100 求汇川机器人IRCB300控制器和示教器同版本升级固件文件升级包
  • ¥15 用visualstudio2022创建vue项目后无法启动
  • ¥15 x趋于0时tanx-sinx极限可以拆开算吗
  • ¥500 把面具戴到人脸上,请大家贡献智慧,别用大模型回答,大模型的答案没啥用
  • ¥15 任意一个散点图自己下载其js脚本文件并做成独立的案例页面,不要作在线的,要离线状态。
  • ¥15 各位 帮我看看如何写代码,打出来的图形要和如下图呈现的一样,急
  • ¥30 c#打开word开启修订并实时显示批注
  • ¥15 如何解决ldsc的这条报错/index error