Revision history for MatrixToLatex


Revision [14594]

Last edited on 2012-12-16 04:02:22 by ToBo
Additions:
Script für [[Octave]] und [[Matlab]] zum formatiren von Matrizen nach [[LaTeX]].
Deletions:
Script für [[Octave]] und [[Matlab]] zum formatiren von Matriizen-Werten nach [[LaTeX]].


Revision [11762]

Edited on 2011-03-13 21:51:10 by ToBo

No Differences

Revision [11761]

Edited on 2011-03-13 21:50:44 by ToBo
Additions:
{{lf code="\vec v = \begin{pmatrix} 0.31 \\ 0.41 \\ 0.73 \\ 0.38 \\ 0.33 \end{pmatrix}"}}
Deletions:
{{lf code="\vec v = \begin{pmatrix} 0.31 \\ 0.41 \\ 0.73 \\ 0.38 \\ 0.33 \end{pmatrix}}}


Revision [11760]

Edited on 2011-03-13 21:50:15 by ToBo
Additions:
=====Matrix to Latex=====
Konvertiert [[Matlab]]- und [[Octave]]-Matrizen oder -Vektoren in Latex-Code
====Beispiele====
==Beispiel 1==
%%(matlab)
A = diag(ones(5,1))
at2latex(A, 0)
%%
{{lf code="A = \begin{pmatrix} 1 & 0 & 0 & 0 & 0 \\ 0 & 1 & 0 & 0 & 0 \\ 0 & 0 & 1 & 0 & 0 \\ 0 & 0 & 0 & 1 & 0 \\ 0 & 0 & 0 & 0 & 1 \end{pmatrix}"}}
==Beispiel 2==
%%(matlab)
B = rand(5,6)
mat2latex(B, 3)
%%
{{lf code="B = \begin{pmatrix} 0.181 & 0.486 & 0.405 & 0.569 & 0.752 & 0.693 \\ 0.593 & 0.913 & 0.966 & 0.079 & 0.328 & 0.627 \\ 0.488 & 0.132 & 0.186 & 0.062 & 0.460 & 0.116 \\ 0.246 & 0.309 & 0.757 & 0.630 & 0.460 & 0.057 \\ 0.943 & 0.416 & 0.947 & 0.200 & 0.334 & 0.432 \end{pmatrix}"}}
==Beispiel 3==
%%(matlab)
v = rand(5,1) % Vector v
mat2latex(v, 2)
%%
{{lf code="\vec v = \begin{pmatrix} 0.31 \\ 0.41 \\ 0.73 \\ 0.38 \\ 0.33 \end{pmatrix}}}
====Script====
Script für [[Octave]] und [[Matlab]] zum formatiren von Matriizen-Werten nach [[LaTeX]].
%%(matlab)
function s = mat2latex(A,dg)
s = '\begin{pmatrix} ';
[M,N] = size(A);
for m=1:M
for n=1:N
s = strcat(s, sprintf([' %0.' num2str(dg) 'f'], A(m,n)) );
if (n~=N)
s = strcat(s,' & ');
end
end
if (m~=M)
s = strcat(s,' \\ ');
end
end
s = strcat(s,' \end{pmatrix}');
%%
Deletions:
=====Titel=====


Revision [11759]

The oldest known version of this page was created on 2011-03-13 21:48:52 by ToBo
Valid XHTML :: Valid CSS: :: Powered by WikkaWiki