matlab函数输出特征值和特征向量

时间:2016-10-03 03:52:11

标签: matlab

我正在编写一个MATLAB函数,它接收一个3x3矩阵,并应输出矩阵的特征值和左特征向量。但是,我现在的功能只是输出第一个输出变量。我试图调试,但无论如何,它总是只输出第一个输出变量(标量或向量)。是否存在我遗漏的明确语法错误?

    function [sigma1,sigma2,sigma3,m1,m2,m3] = determinePrincipalState(s11,...
s12,s13,s21,s22,s23,s31,s32,s33)

% determinePrincipalState takes a 3x3 stress tensor and computes the
% principal stresses and directions.

% Set up stress tensor
sigma = [s11 s12 s13; s21 s22 s23; s31 s32 s33];

% Calculate eigenvalues and eigenvectors (column vectors)
[R V L] = eig(sigma);

% Define outputs
sigma1 = V(1,1); sigma2 = V(2,2); sigma3 = V(3,3);
m1 = [L(1,1); L(2,1); L(3,1)];
m2 = [L(1,2); L(2,2); L(3,2)];
m3 = [L(1,3); L(2,3); L(3,3)];

end

0 个答案:

没有答案