[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [O] workflow, matlab+latex in org file
From: |
Uwe Brauer |
Subject: |
Re: [O] workflow, matlab+latex in org file |
Date: |
Tue, 12 Jul 2016 12:44:59 +0000 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/25.1.50 (gnu/linux) |
>>> "Eric" == Eric S Fraga <address@hidden> writes:
> On Monday, 11 Jul 2016 at 12:32, Uwe Brauer wrote:
>> Hello
>>
>> I want in a org file, to include matlab code and run it (that I know how
>> to do)
>>
>> Then I want certain results, which are symbolic variables, expressed in
>> latex, we I achieve using matlab's latex command.
>>
>> Like
>>
>> #+begin_src matlab :results output
>> clear all
>> syms e p R g w K K2
>> phi=[(e + (e+p)*R^2)^((g-1)/2);((e+p)*R*sqrt(1+R^2))/(e+(e+p)*R^2)]
>>
>> jac=jacobian(phi,[e,p])
>> ltxjac=latex(jac)
>> #+end_src
> A bit of a kludge but, if you don't want to modify the ob-matlab code,
> you can explicitly generate LaTeX into a file and use it directly:
> #+begin_src octave :exports none :results output
> clear all
> pkg load symbolic
> syms e p R g w K K2;
> phi=[(e + (e+p)*R^2)^((g-1)/2);((e+p)*R*sqrt(1+R^2))/(e+(e+p)*R^2)];
> jac=jacobian(phi,[e,p]);
> ltxjac = latex(jac);
> fid = fopen("jacobian.tex","w");
> fprintf(fid, "%s\n", ltxjac);
> fclose(fid);
> ltxjac
> #+end_src
> \begin{equation}
> \input{jacobian}
> \end{equation}
Thanks, that is a solution but a bit cumbersome because of the
additional latex file. John sent me a hack which seems a bit more
flexible.
Uwe
> I don't have MATLAB so have tested with octave instead...