如何在matlab中求解线性符号方程

How to solve linear symbolic equations in matlab

我正在尝试在 Matlab 中求解以下线性符号系统(20 个方程),我将解中的所有值都设为零,我的实现是否有任何错误? 代码中使用的数据在这里 data

%---------------------
% clear and close all
%---------------------
clearvars
close all
clc
%---------------------
% Data type long
%---------------------
format long g
%---------------------
% Read data
%---------------------
load('data.mat')
%---------------------------
% Symbolic variables
syms X11 X12 X13 X14 X21 X22 X23 X24 X31 X32 X33 X34 X41 X42 X43 X44;
%========================
% Quadric 4 x 4 matrix
Q = [X11, X12, X13, X14;
    X21, X22, X23, X24;
    X31, X32, X33, X34;
    X41, X42, X43, X44];

% loop all projections
for i=1:10
    % for wach projection matrix
    P = PPM(:, :, i);

    % Autocalibration equation
    DIAC(3*(i-1)+1:3*i,:) = P * Q * P';

    L(2*(i-1)+1:2*i,1) = DIAC(3*(i-1)+1:3*i-1,3)==0 ;
end

[A,B] = equationsToMatrix(L,[X11, X12, X13, X14,...
     X21, X22, X23, X24, X31, X32, X33, X34,X41, X42, X43, X44]);

Sol = linsolve(A,B)

这个site解释了解决方案,按照我得到的解释:

[Mat,B] = equationsToMatrix(L,[X11, X12, X13, X14,...
     X21, X22, X23, X24, X31, X32, X33, X34,X41, X42, X43, X44]);
% Solution is here
Sol = linsolve(Mat,B);