【发布时间】:2019-02-14 05:59:26
【问题描述】:
我正在学习使用 matlab。在下面的代码中,我想应用 mldivide 函数https://www.mathworks.com/help/matlab/ref/mldivide.html 但是,我对函数如何处理输出有点困惑。根据文档https://www.mathworks.com/help/matlab/ref/function.html,当我在命令窗口中调用我的函数时,我应该向我吐出 out1、out2 和 out3。但只显示 out1。为什么?
function [out1, out2, out3] = testSystem(in1, in2, in3)
b = [in1; in2; in3];
A = [2, 1, 1;
-1, 1, -1;
1, 2, 3;];
x = A\b;
disp(x);
out1 = x(1,1);
out2 = x(2,1);
out3 = x(3,1);
end
>> testSystem(2,3,-10)
3
1
-5
ans =
3
【问题讨论】:
-
您链接的页面具有正确的语法,位于“示例”部分的“具有多个输出的函数”标题下方:mathworks.com/help/matlab/ref/function.html#btexm36
标签: matlab