八度:将矩阵导出到文件

时间:2018-06-25 20:57:49

标签: matrix export octave

我猜想有一个简单的解决方案,但是我主要使用八度来交互式地求解方程组online。问题是我当前问题的输出太大而无法轻松复制(手动复制或使用复制/粘贴复制到另一个文件中),而且我不确定如何导出它。文本,LaTeX,.csv甚至其他内容都可以,但似乎将其导出会很有用。

问题是屏幕中断了输出,因此很难读取/复制而不会出现错误。下面的代码(我要导出的矩阵C):

syms a b c q r s t x
A = [ 1 , -x*a, -x*(1-a); -x*b, 1, -x*(1-b); -x*c, -x*(1-c), 1]
Ainv = inv(A)

B = [t + q; t+ r; t+s]

C = Ainv*B

我已经尝试过save命令,但是它似乎没有做任何我可以告诉的事情。例如:save temp.txt, C只是重述了该命令,但似乎没有迹象表明已保存到我的计算机(甚至有机会这样做/征求了将其保存到某处的权限)。

感谢您的帮助。谢谢!

1 个答案:

答案 0 :(得分:2)

@sym/latex,因此很容易获得乳胶:

octave:> latex (C)
\left[\begin{matrix}\left(q + t\right) \left(\frac{a b x^{2}}{- a b x^{2} + 1} - \frac{\left(a b x^{2} - 1\right) \left(\frac{a x}{- a b x^{2} + 1} \left(- b x^{2} \left(- a + 1\right) - x \left(- b + 1\right)\right) - x \left(- a + 1\right)\right) \left(- \frac{b x \left(- a c x^{2} - x \left(- c + 1\right)\right)}{- a b x^{2} + 1} + c x\right)}{- x^{2} \left(a c x - c + 1\right) \left(b x \left(a - 1\right) + b - 1\right) + \left(a b x^{2} - 1\right) \left(c x^{2} \left(a - 1\right) + 1\right)} + 1\right) + \left(r + t\right) \left(\frac{a x}{- a b x^{2} + 1} + \frac{\left(a b x^{2} - 1\right) \left(- a c x^{2} - x \left(- c + 1\right)\right) \left(\frac{a x}{- a b x^{2} + 1} \left(- b x^{2} \left(- a + 1\right) - x \left(- b + 1\right)\right) - x \left(- a + 1\right)\right)}{\left(- a b x^{2} + 1\right) \left(- x^{2} \left(a c x - c + 1\right) \left(b x \left(a - 1\right) + b - 1\right) + \left(a b x^{2} - 1\right) \left(c x^{2} \left(a - 1\right) + 1\right)\right)}\right) - \frac{\left(s + t\right) \left(a b x^{2} - 1\right) \left(\frac{a x}{- a b x^{2} + 1} \left(- b x^{2} \left(- a + 1\right) - x \left(- b + 1\right)\right) - x \left(- a + 1\right)\right)}{- x^{2} \left(a c x - c + 1\right) \left(b x \left(a - 1\right) + b - 1\right) + \left(a b x^{2} - 1\right) \left(c x^{2} \left(a - 1\right) + 1\right)}\\\left(q + t\right) \left(\frac{b x}{- a b x^{2} + 1} - \frac{\left(a b x^{2} - 1\right) \left(- b x^{2} \left(- a + 1\right) - x \left(- b + 1\right)\right) \left(- \frac{b x \left(- a c x^{2} - x \left(- c + 1\right)\right)}{- a b x^{2} + 1} + c x\right)}{\left(- a b x^{2} + 1\right) \left(- x^{2} \left(a c x - c + 1\right) \left(b x \left(a - 1\right) + b - 1\right) + \left(a b x^{2} - 1\right) \left(c x^{2} \left(a - 1\right) + 1\right)\right)}\right) + \left(r + t\right) \left(\frac{1}{- a b x^{2} + 1} + \frac{\left(a b x^{2} - 1\right) \left(- a c x^{2} - x \left(- c + 1\right)\right) \left(- b x^{2} \left(- a + 1\right) - x \left(- b + 1\right)\right)}{\left(- a b x^{2} + 1\right)^{2} \left(- x^{2} \left(a c x - c + 1\right) \left(b x \left(a - 1\right) + b - 1\right) + \left(a b x^{2} - 1\right) \left(c x^{2} \left(a - 1\right) + 1\right)\right)}\right) - \frac{\left(s + t\right) \left(a b x^{2} - 1\right) \left(- b x^{2} \left(- a + 1\right) - x \left(- b + 1\right)\right)}{\left(- a b x^{2} + 1\right) \left(- x^{2} \left(a c x - c + 1\right) \left(b x \left(a - 1\right) + b - 1\right) + \left(a b x^{2} - 1\right) \left(c x^{2} \left(a - 1\right) + 1\right)\right)}\\\frac{\left(q + t\right) \left(a b x^{2} - 1\right) \left(- \frac{b x \left(- a c x^{2} - x \left(- c + 1\right)\right)}{- a b x^{2} + 1} + c x\right)}{- x^{2} \left(a c x - c + 1\right) \left(b x \left(a - 1\right) + b - 1\right) + \left(a b x^{2} - 1\right) \left(c x^{2} \left(a - 1\right) + 1\right)} - \frac{\left(r + t\right) \left(a b x^{2} - 1\right) \left(- a c x^{2} - x \left(- c + 1\right)\right)}{\left(- a b x^{2} + 1\right) \left(- x^{2} \left(a c x - c + 1\right) \left(b x \left(a - 1\right) + b - 1\right) + \left(a b x^{2} - 1\right) \left(c x^{2} \left(a - 1\right) + 1\right)\right)} + \frac{\left(s + t\right) \left(a b x^{2} - 1\right)}{- x^{2} \left(a c x - c + 1\right) \left(b x \left(a - 1\right) + b - 1\right) + \left(a b x^{2} - 1\right) \left(c x^{2} \left(a - 1\right) + 1\right)}\end{matrix}\right]

可以呈现为

rendered