|
From: Uwe B. <ou...@ma...> - 2017-11-04 15:35:00
|
<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
<style type="text/css">body p { margin-bottom: 0cm; margin-top: 0pt; } </style>
</head>
<body bidimailui-detected-decoding-type="latin-charset"
bgcolor="#FFFFFF" text="#000000">
<div class="moz-cite-prefix">On 11/03/2017 03:47 PM, Eric Ludlam
wrote:<br>
</div>
<blockquote
cite="mid:MWH...@MW..."
type="cite">
<pre wrap="">Ah, sorry I can't be more help. It has been many years since I worked on that code, and I don't use Emacs much anymore. There are accommodations in the function's I referenced for the ML command line to make sure it doesn't interrupting anything a user might be typing in that would be important for your use case.
</pre>
</blockquote>
<br>
Ok fair enough. I think I made some progress but still have a small<br>
problem, maybe you might remember and help. :-D<br>
<br>
John's code consists of:<br>
<br>
- cleaning the matlab code in orgmode mode: (font lock stuff
etc)<br>
and collect it.<br>
<br>
- create a temporally file and insert the clean matlab
commands.<br>
<br>
- run a external matlab process via<br>
"/usr/local/bin/matlab " "-nodesktop <" m-file<br>
<br>
- clean the result and insert it in the original buffer.<br>
<br>
So my solution is to use the matlab-shell-collect-command-output<br>
function. So my code is:<br>
<br>
- cleaning the matlab code in orgmode mode: (font lock stuff
etc)<br>
and collect it.<br>
<br>
- run (matlab-shell-collect-command-output code) where code<br>
corresponds to the clean code from step one which John
inserts in<br>
temp buffer.<br>
<br>
- clean the result and insert it in the original buffer.<br>
<br>
<br>
The only problem is that the output of the<br>
/usr/local/bin/matlab -nodesktop < m-file<br>
<br>
And (matlab-shell-collect-command-output code)<br>
is slightly different.<br>
Take the following example.<br>
<br>
f=@(t,y)[-t*y^2];<br>
[t,y]=ode45(f,[0 1],1);<br>
t=[t(1),t(end)];<br>
y=[y(1),y(end)];<br>
disp('\begin{align*}')<br>
fprintf('t = [%g \\quad %g] \\\\\n', t)<br>
fprintf('y = [%g \\qquad %g] \n', y)<br>
disp('\end{align*}')<br>
<br>
The external matlab command does not include the fprintf in his
output.<br>
I have collected the output of both approaches including the result
of<br>
the cleaning function.<br>
<br>
So there are two possibilities. <br>
<br>
- Modify matlab-shell-collect-command-output so that it behaves
closer to<br>
/usr/local/bin/matlab -nodesktop < m-file<br>
<br>
- modify the cleaning function (which I don't understand but
could<br>
ask John about it).<br>
<br>
(when results<br>
;; strip out >><br>
(setq results (replace-regexp-in-string ">> " "" results))<br>
;; remove first 10 lines that are the header.<br>
(setq results (mapconcat 'identity<br>
(nthcdr 10 (split-string results "\n"))<br>
"\n")))<br>
<br>
<br>
Any comment is more than welcome. Here is the output of both
commands<br>
<br>
<br>
<br>
Uwe<br>
<br>
<div id="content">
<div id="outline-container-org102ba5b" class="outline-2">
<h2 id="org102ba5b"><span class="section-number-2">1</span>
Matlab and the cleaning</h2>
<div class="outline-text-2" id="text-1">
</div>
<div id="outline-container-org7653ede" class="outline-3">
<h3 id="org7653ede"><span class="section-number-3">1.1</span>
Result Matlab (John)</h3>
<div class="outline-text-3" id="text-1-1">
<p>
Result: "\n< M A T L A B (R) >\nCopyright 1984-2012
The MathWorks, Inc.\nR2012a (7.14.0.739) 32-bit
(glnx86)\nFebruary 9, 2012\n\n\nToget started, type one of
these: helpwin, helpdesk, or demo.\nForproduct
information, visit <a class="moz-txt-link-abbreviated" href="http://www.mathworks.com.\n\n">www.mathworks.com.\n\n</a>>> >>
>> >> >> \\begin{align*}\n>> t =
[0 \\quad1] \\\\\n>> y = [1 \\qquad0.666667]
\n>> \\end{align*}\n>> "<br>
Stop<br>
[2 times]<br>
Result: "\n< M A T L A B (R) >\nCopyright 1984-2012
The MathWorks, Inc.\nR2012a (7.14.0.739) 32-bit
(glnx86)\nFebruary 9, 2012\n\n\nToget started, type one of
these: helpwin, helpdesk, or demo.\nForproduct
information, visit <a class="moz-txt-link-abbreviated" href="http://www.mathworks.com.\n\n">www.mathworks.com.\n\n</a>>> >>
>> >> >> \\begin{align*}\n>> t =
[0 \\quad1] \\\\\n>> y = [1 \\qquad0.666667]
\n>> \\end{align*}\n>> "<br>
[3 times]<br>
Result: "\n< M A T L A B (R) >\nCopyright 1984-2012
The MathWorks, Inc.\nR2012a (7.14.0.739) 32-bit
(glnx86)\nFebruary 9, 2012\n\n\nToget started, type one of
these: helpwin, helpdesk, or demo.\nForproduct
information, visit <a class="moz-txt-link-abbreviated" href="http://www.mathworks.com.\n\n">www.mathworks.com.\n\n</a>>> >>
>> >> >> \\begin{align*}\n>> t =
[0 \\quad1] \\\\\n>> y = [1 \\qquad0.666667]
\n>> \\end{align*}\n>> "<br>
</p>
<p>
Result: "\n< M A T L A B (R) >\nCopyright 1984-2012
The MathWorks, Inc.\nR2012a (7.14.0.739) 32-bit
(glnx86)\nFebruary 9, 2012\n\n\nToget started, type one of
these: helpwin, helpdesk, or demo.\nForproduct
information, visit
<a class="moz-txt-link-abbreviated" href="http://www.mathworks.com.\n\n\\begin">www.mathworks.com.\n\n\\begin</a>{align*}\nt= [0 \\quad1]
\\\\\ny= [1 \\qquad0.666667] \n\\end{align*}\n"<br>
</p>
<p>
Result: "\n< M A T L A B (R) >\nCopyright 1984-2012
The MathWorks, Inc.\nR2012a (7.14.0.739) 32-bit
(glnx86)\nFebruary 9, 2012\n\n\nToget started, type one of
these: helpwin, helpdesk, or demo.\nForproduct
information, visit
<a class="moz-txt-link-abbreviated" href="http://www.mathworks.com.\n\n\\begin">www.mathworks.com.\n\n\\begin</a>{align*}\nt= [0 \\quad1]
\\\\\ny= [1 \\qquad0.666667] \n\\end{align*}\n"<br>
[5 times]<br>
Result: "\n< M A T L A B (R) >\nCopyright 1984-2012
The MathWorks, Inc.\nR2012a (7.14.0.739) 32-bit
(glnx86)\nFebruary 9, 2012\n\n\nToget started, type one of
these: helpwin, helpdesk, or demo.\nForproduct
information, visit
<a class="moz-txt-link-abbreviated" href="http://www.mathworks.com.\n\n\\begin">www.mathworks.com.\n\n\\begin</a>{align*}\nt= [0 \\quad1]
\\\\\ny= [1 \\qquad0.666667] \n\\end{align*}\n"<br>
</p>
<p>
Result: (#1="" " < M A T L A B (R) >" " Copyright
1984-2012 The MathWorks, Inc." " R2012a (7.14.0.739)
32-bit (glnx86)" " February 9, 2012" #1# " " "To get
started, type one of these: helpwin, helpdesk, or demo."
"For product information, visit <a class="moz-txt-link-abbreviated" href="http://www.mathworks.com">www.mathworks.com</a>." " "
"\\begin{align*}" "t = [0 \\quad1] \\\\" "y = [1
\\qquad0.666667] " "\\end{align*}" #1#)<br>
</p>
</div>
</div>
<div id="outline-container-org1203d4a" class="outline-3">
<h3 id="org1203d4a"><span class="section-number-3">1.2</span>
Result cleaning (John)</h3>
<div class="outline-text-3" id="text-1-2">
<p>
Result: ("\\begin{align*}" "t = [0 \\quad1] \\\\" "y = [1
\\qquad0.666667] " "\\end{align*}" "")<br>
</p>
<p>
Result: "\\begin{align*}\nt= [0 \\quad1] \\\\\ny= [1
\\qquad0.666667] \n\\end{align*}\n"<br>
</p>
<p>
Result: "\\begin{align*}\nt= [0 \\quad1] \\\\\ny= [1
\\qquad0.666667] \n\\end{align*}\n"<br>
</p>
<p>
Result: "\\begin{align*}\nt= [0 \\quad1] \\\\\ny= [1
\\qquad0.666667] \n\\end{align*}\n"<br>
[2 times]<br>
Result: ("replace" "output" "latex")<br>
</p>
<p>
Result: "\\begin{align*}\nt= [0 \\quad1] \\\\\ny= [1
\\qquad0.666667] \n\\end{align*}\n"<br>
</p>
<p>
Result: "\\begin{align*}\nt= [0 \\quad1] \\\\\ny= [1
\\qquad0.666667] \n\\end{align*}\n"<br>
</p>
<p>
Result: "\\begin{align*}\nt= [0 \\quad1] \\\\\ny= [1
\\qquad0.666667] \n\\end{align*}\n"<br>
</p>
<p>
Result: "\\begin{align*}\nt= [0 \\quad1] \\\\\ny= [1
\\qquad0.666667] \n\\end{align*}\n"<br>
</p>
</div>
</div>
<div id="outline-container-org417a7b3" class="outline-3">
<h3 id="org417a7b3"><span class="section-number-3">1.3</span>
Result Matlab (Shell)</h3>
<div class="outline-text-3" id="text-1-3">
<p>
Result: "f=@(t,y)[-t*y<sup>2</sup>];\n[t,y]=ode45(f,[0
1],1);\nt=[t(1),t(end)];\ny=[y(1),y(end)];\ndisp('\\begin{align*}')\nfprintf('t
= [%g \\\\quad%g] \\\\\\\\\\n', t)\nfprintf('y = [%g
\\\\qquad%g] \\n', y)\ndisp('\\end{align*}')\n"<br>
</p>
<p>
Result: ">> [t,y]=ode45(f,[0 1],1);\n>>
t=[t(1),t(end)];\n>> y=[y(1),y(end)];\n>>
disp('\\begin{align*}')\n\\begin{align*}\n>>
fprintf('t = [%g \\\\quad%g] \\\\\\\\\\n', t)\nt= [0
\\quad1] \\\\\n>> fprintf('y = [%g \\\\qquad%g]
\\n', y)\ny= [1 \\qquad0.666667] \n>>
disp('\\end{align*}')\n\\end{align*}\n>> \n>>
\n"<br>
[2 times]<br>
Result: ">> [t,y]=ode45(f,[0 1],1);\n>>
t=[t(1),t(end)];\n>> y=[y(1),y(end)];\n>>
disp('\\begin{align*}')\n\\begin{align*}\n>>
fprintf('t = [%g \\\\quad%g] \\\\\\\\\\n', t)\nt= [0
\\quad1] \\\\\n>> fprintf('y = [%g \\\\qquad%g]
\\n', y)\ny= [1 \\qquad0.666667] \n>>
disp('\\end{align*}')\n\\end{align*}\n>> \n>>
\n"<br>
[3 times]<br>
Result: ">> [t,y]=ode45(f,[0 1],1);\n>>
t=[t(1),t(end)];\n>> y=[y(1),y(end)];\n>>
disp('\\begin{align*}')\n\\begin{align*}\n>>
fprintf('t = [%g \\\\quad%g] \\\\\\\\\\n', t)\nt= [0
\\quad1] \\\\\n>> fprintf('y = [%g \\\\qquad%g]
\\n', y)\ny= [1 \\qquad0.666667] \n>>
disp('\\end{align*}')\n\\end{align*}\n>> \n>>
\n"<br>
</p>
<p>
Result: "[t,y]=ode45(f,[0
1],1);\nt=[t(1),t(end)];\ny=[y(1),y(end)];\ndisp('\\begin{align*}')\n\\begin{align*}\nfprintf('t
= [%g \\\\quad%g] \\\\\\\\\\n', t)\nt= [0 \\quad1]
\\\\\nfprintf('y = [%g \\\\qquad%g] \\n', y)\ny= [1
\\qquad0.666667]
\ndisp('\\end{align*}')\n\\end{align*}\n\n\n"<br>
</p>
<p>
Result: "[t,y]=ode45(f,[0
1],1);\nt=[t(1),t(end)];\ny=[y(1),y(end)];\ndisp('\\begin{align*}')\n\\begin{align*}\nfprintf('t
= [%g \\\\quad%g] \\\\\\\\\\n', t)\nt= [0 \\quad1]
\\\\\nfprintf('y = [%g \\\\qquad%g] \\n', y)\ny= [1
\\qquad0.666667]
\ndisp('\\end{align*}')\n\\end{align*}\n\n\n"<br>
[5 times]<br>
Result: "[t,y]=ode45(f,[0
1],1);\nt=[t(1),t(end)];\ny=[y(1),y(end)];\ndisp('\\begin{align*}')\n\\begin{align*}\nfprintf('t
= [%g \\\\quad%g] \\\\\\\\\\n', t)\nt= [0 \\quad1]
\\\\\nfprintf('y = [%g \\\\qquad%g] \\n', y)\ny= [1
\\qquad0.666667]
\ndisp('\\end{align*}')\n\\end{align*}\n\n\n"<br>
</p>
<p>
Result: ("[t,y]=ode45(f,[0 1],1);" "t=[t(1),t(end)];"
"y=[y(1),y(end)];" "disp('\\begin{align*}')"
"\\begin{align*}" "fprintf('t = [%g \\\\quad%g]
\\\\\\\\\\n', t)" "t = [0 \\quad1] \\\\" "fprintf('y = [%g
\\\\qquad%g] \\n', y)" "y = [1 \\qquad0.666667] "
"disp('\\end{align*}')" "\\end{align*}" #1="" #1# #1#)<br>
</p>
</div>
</div>
<div id="outline-container-org40deade" class="outline-3">
<h3 id="org40deade"><span class="section-number-3">1.4</span>
Result cleaning</h3>
<div class="outline-text-3" id="text-1-4">
<p>
Result: ("t=[t(1),t(end)];" "y=[y(1),y(end)];"
"disp('\\begin{align*}')" "\\begin{align*}" "fprintf('t =
[%g \\\\quad%g] \\\\\\\\\\n', t)" "t = [0 \\quad1] \\\\"
"fprintf('y = [%g \\\\qquad%g] \\n', y)" "y = [1
\\qquad0.666667] " "disp('\\end{align*}')" "\\end{align*}"
#1="" #1# #1#)<br>
</p>
<p>
Result:
"t=[t(1),t(end)];\ny=[y(1),y(end)];\ndisp('\\begin{align*}')\n\\begin{align*}\nfprintf('t
= [%g \\\\quad%g] \\\\\\\\\\n', t)\nt= [0 \\quad1]
\\\\\nfprintf('y = [%g \\\\qquad%g] \\n', y)\ny= [1
\\qquad0.666667]
\ndisp('\\end{align*}')\n\\end{align*}\n\n\n"<br>
</p>
<p>
Result:
"t=[t(1),t(end)];\ny=[y(1),y(end)];\ndisp('\\begin{align*}')\n\\begin{align*}\nfprintf('t
= [%g \\\\quad%g] \\\\\\\\\\n', t)\nt= [0 \\quad1]
\\\\\nfprintf('y = [%g \\\\qquad%g] \\n', y)\ny= [1
\\qquad0.666667]
\ndisp('\\end{align*}')\n\\end{align*}\n\n\n"<br>
</p>
<p>
Result:
"t=[t(1),t(end)];\ny=[y(1),y(end)];\ndisp('\\begin{align*}')\n\\begin{align*}\nfprintf('t
= [%g \\\\quad%g] \\\\\\\\\\n', t)\nt= [0 \\quad1]
\\\\\nfprintf('y = [%g \\\\qquad%g] \\n', y)\ny= [1
\\qquad0.666667]
\ndisp('\\end{align*}')\n\\end{align*}\n\n\n"<br>
</p>
</div>
</div>
</div>
</div>
<div id="postamble" class="status">
<p class="date">Created: 2017-11-04 Sat 15:26</p>
<p class="validation"><a
href="http://validator.w3.org/check?uri=referer">Validate</a></p>
</div>
<br>
<div id="content">
<div id="outline-container-org102ba5b" class="outline-2">
<h2 id="org102ba5b"><span class="section-number-2">1</span>
Matlab and the cleaning</h2>
<div class="outline-text-2" id="text-1">
</div>
<div id="outline-container-org7653ede" class="outline-3">
<h3 id="org7653ede"><span class="section-number-3">1.1</span>
Result Matlab (John)</h3>
<div class="outline-text-3" id="text-1-1">
<p>
Result: "\n< M A T L A B (R) >\nCopyright 1984-2012
The MathWorks, Inc.\nR2012a (7.14.0.739) 32-bit
(glnx86)\nFebruary 9, 2012\n\n\nToget started, type one of
these: helpwin, helpdesk, or demo.\nForproduct
information, visit <a class="moz-txt-link-abbreviated" href="http://www.mathworks.com.\n\n">www.mathworks.com.\n\n</a>>> >>
>> >> >> \\begin{align*}\n>> t =
[0 \\quad1] \\\\\n>> y = [1 \\qquad0.666667]
\n>> \\end{align*}\n>> "<br>
Stop<br>
[2 times]<br>
Result: "\n< M A T L A B (R) >\nCopyright 1984-2012
The MathWorks, Inc.\nR2012a (7.14.0.739) 32-bit
(glnx86)\nFebruary 9, 2012\n\n\nToget started, type one of
these: helpwin, helpdesk, or demo.\nForproduct
information, visit <a class="moz-txt-link-abbreviated" href="http://www.mathworks.com.\n\n">www.mathworks.com.\n\n</a>>> >>
>> >> >> \\begin{align*}\n>> t =
[0 \\quad1] \\\\\n>> y = [1 \\qquad0.666667]
\n>> \\end{align*}\n>> "<br>
[3 times]<br>
Result: "\n< M A T L A B (R) >\nCopyright 1984-2012
The MathWorks, Inc.\nR2012a (7.14.0.739) 32-bit
(glnx86)\nFebruary 9, 2012\n\n\nToget started, type one of
these: helpwin, helpdesk, or demo.\nForproduct
information, visit <a class="moz-txt-link-abbreviated" href="http://www.mathworks.com.\n\n">www.mathworks.com.\n\n</a>>> >>
>> >> >> \\begin{align*}\n>> t =
[0 \\quad1] \\\\\n>> y = [1 \\qquad0.666667]
\n>> \\end{align*}\n>> "<br>
</p>
<p>
Result: "\n< M A T L A B (R) >\nCopyright 1984-2012
The MathWorks, Inc.\nR2012a (7.14.0.739) 32-bit
(glnx86)\nFebruary 9, 2012\n\n\nToget started, type one of
these: helpwin, helpdesk, or demo.\nForproduct
information, visit
<a class="moz-txt-link-abbreviated" href="http://www.mathworks.com.\n\n\\begin">www.mathworks.com.\n\n\\begin</a>{align*}\nt= [0 \\quad1]
\\\\\ny= [1 \\qquad0.666667] \n\\end{align*}\n"<br>
</p>
<p>
Result: "\n< M A T L A B (R) >\nCopyright 1984-2012
The MathWorks, Inc.\nR2012a (7.14.0.739) 32-bit
(glnx86)\nFebruary 9, 2012\n\n\nToget started, type one of
these: helpwin, helpdesk, or demo.\nForproduct
information, visit
<a class="moz-txt-link-abbreviated" href="http://www.mathworks.com.\n\n\\begin">www.mathworks.com.\n\n\\begin</a>{align*}\nt= [0 \\quad1]
\\\\\ny= [1 \\qquad0.666667] \n\\end{align*}\n"<br>
[5 times]<br>
Result: "\n< M A T L A B (R) >\nCopyright 1984-2012
The MathWorks, Inc.\nR2012a (7.14.0.739) 32-bit
(glnx86)\nFebruary 9, 2012\n\n\nToget started, type one of
these: helpwin, helpdesk, or demo.\nForproduct
information, visit
<a class="moz-txt-link-abbreviated" href="http://www.mathworks.com.\n\n\\begin">www.mathworks.com.\n\n\\begin</a>{align*}\nt= [0 \\quad1]
\\\\\ny= [1 \\qquad0.666667] \n\\end{align*}\n"<br>
</p>
<p>
Result: (#1="" " < M A T L A B (R) >" " Copyright
1984-2012 The MathWorks, Inc." " R2012a (7.14.0.739)
32-bit (glnx86)" " February 9, 2012" #1# " " "To get
started, type one of these: helpwin, helpdesk, or demo."
"For product information, visit <a class="moz-txt-link-abbreviated" href="http://www.mathworks.com">www.mathworks.com</a>." " "
"\\begin{align*}" "t = [0 \\quad1] \\\\" "y = [1
\\qquad0.666667] " "\\end{align*}" #1#)<br>
</p>
</div>
</div>
<div id="outline-container-org1203d4a" class="outline-3">
<h3 id="org1203d4a"><span class="section-number-3">1.2</span>
Result cleaning (John)</h3>
<div class="outline-text-3" id="text-1-2">
<p>
Result: ("\\begin{align*}" "t = [0 \\quad1] \\\\" "y = [1
\\qquad0.666667] " "\\end{align*}" "")<br>
</p>
<p>
Result: "\\begin{align*}\nt= [0 \\quad1] \\\\\ny= [1
\\qquad0.666667] \n\\end{align*}\n"<br>
</p>
<p>
Result: "\\begin{align*}\nt= [0 \\quad1] \\\\\ny= [1
\\qquad0.666667] \n\\end{align*}\n"<br>
</p>
<p>
Result: "\\begin{align*}\nt= [0 \\quad1] \\\\\ny= [1
\\qquad0.666667] \n\\end{align*}\n"<br>
[2 times]<br>
Result: ("replace" "output" "latex")<br>
</p>
<p>
Result: "\\begin{align*}\nt= [0 \\quad1] \\\\\ny= [1
\\qquad0.666667] \n\\end{align*}\n"<br>
</p>
<p>
Result: "\\begin{align*}\nt= [0 \\quad1] \\\\\ny= [1
\\qquad0.666667] \n\\end{align*}\n"<br>
</p>
<p>
Result: "\\begin{align*}\nt= [0 \\quad1] \\\\\ny= [1
\\qquad0.666667] \n\\end{align*}\n"<br>
</p>
<p>
Result: "\\begin{align*}\nt= [0 \\quad1] \\\\\ny= [1
\\qquad0.666667] \n\\end{align*}\n"<br>
</p>
</div>
</div>
<div id="outline-container-org417a7b3" class="outline-3">
<h3 id="org417a7b3"><span class="section-number-3">1.3</span>
Result Matlab (Shell)</h3>
<div class="outline-text-3" id="text-1-3">
<p>
Result: "f=@(t,y)[-t*y<sup>2</sup>];\n[t,y]=ode45(f,[0
1],1);\nt=[t(1),t(end)];\ny=[y(1),y(end)];\ndisp('\\begin{align*}')\nfprintf('t
= [%g \\\\quad%g] \\\\\\\\\\n', t)\nfprintf('y = [%g
\\\\qquad%g] \\n', y)\ndisp('\\end{align*}')\n"<br>
</p>
<p>
Result: ">> [t,y]=ode45(f,[0 1],1);\n>>
t=[t(1),t(end)];\n>> y=[y(1),y(end)];\n>>
disp('\\begin{align*}')\n\\begin{align*}\n>>
fprintf('t = [%g \\\\quad%g] \\\\\\\\\\n', t)\nt= [0
\\quad1] \\\\\n>> fprintf('y = [%g \\\\qquad%g]
\\n', y)\ny= [1 \\qquad0.666667] \n>>
disp('\\end{align*}')\n\\end{align*}\n>> \n>>
\n"<br>
[2 times]<br>
Result: ">> [t,y]=ode45(f,[0 1],1);\n>>
t=[t(1),t(end)];\n>> y=[y(1),y(end)];\n>>
disp('\\begin{align*}')\n\\begin{align*}\n>>
fprintf('t = [%g \\\\quad%g] \\\\\\\\\\n', t)\nt= [0
\\quad1] \\\\\n>> fprintf('y = [%g \\\\qquad%g]
\\n', y)\ny= [1 \\qquad0.666667] \n>>
disp('\\end{align*}')\n\\end{align*}\n>> \n>>
\n"<br>
[3 times]<br>
Result: ">> [t,y]=ode45(f,[0 1],1);\n>>
t=[t(1),t(end)];\n>> y=[y(1),y(end)];\n>>
disp('\\begin{align*}')\n\\begin{align*}\n>>
fprintf('t = [%g \\\\quad%g] \\\\\\\\\\n', t)\nt= [0
\\quad1] \\\\\n>> fprintf('y = [%g \\\\qquad%g]
\\n', y)\ny= [1 \\qquad0.666667] \n>>
disp('\\end{align*}')\n\\end{align*}\n>> \n>>
\n"<br>
</p>
<p>
Result: "[t,y]=ode45(f,[0
1],1);\nt=[t(1),t(end)];\ny=[y(1),y(end)];\ndisp('\\begin{align*}')\n\\begin{align*}\nfprintf('t
= [%g \\\\quad%g] \\\\\\\\\\n', t)\nt= [0 \\quad1]
\\\\\nfprintf('y = [%g \\\\qquad%g] \\n', y)\ny= [1
\\qquad0.666667]
\ndisp('\\end{align*}')\n\\end{align*}\n\n\n"<br>
</p>
<p>
Result: "[t,y]=ode45(f,[0
1],1);\nt=[t(1),t(end)];\ny=[y(1),y(end)];\ndisp('\\begin{align*}')\n\\begin{align*}\nfprintf('t
= [%g \\\\quad%g] \\\\\\\\\\n', t)\nt= [0 \\quad1]
\\\\\nfprintf('y = [%g \\\\qquad%g] \\n', y)\ny= [1
\\qquad0.666667]
\ndisp('\\end{align*}')\n\\end{align*}\n\n\n"<br>
[5 times]<br>
Result: "[t,y]=ode45(f,[0
1],1);\nt=[t(1),t(end)];\ny=[y(1),y(end)];\ndisp('\\begin{align*}')\n\\begin{align*}\nfprintf('t
= [%g \\\\quad%g] \\\\\\\\\\n', t)\nt= [0 \\quad1]
\\\\\nfprintf('y = [%g \\\\qquad%g] \\n', y)\ny= [1
\\qquad0.666667]
\ndisp('\\end{align*}')\n\\end{align*}\n\n\n"<br>
</p>
<p>
Result: ("[t,y]=ode45(f,[0 1],1);" "t=[t(1),t(end)];"
"y=[y(1),y(end)];" "disp('\\begin{align*}')"
"\\begin{align*}" "fprintf('t = [%g \\\\quad%g]
\\\\\\\\\\n', t)" "t = [0 \\quad1] \\\\" "fprintf('y = [%g
\\\\qquad%g] \\n', y)" "y = [1 \\qquad0.666667] "
"disp('\\end{align*}')" "\\end{align*}" #1="" #1# #1#)<br>
</p>
</div>
</div>
<div id="outline-container-org40deade" class="outline-3">
<h3 id="org40deade"><span class="section-number-3">1.4</span>
Result cleaning</h3>
<div class="outline-text-3" id="text-1-4">
<p>
Result: ("t=[t(1),t(end)];" "y=[y(1),y(end)];"
"disp('\\begin{align*}')" "\\begin{align*}" "fprintf('t =
[%g \\\\quad%g] \\\\\\\\\\n', t)" "t = [0 \\quad1] \\\\"
"fprintf('y = [%g \\\\qquad%g] \\n', y)" "y = [1
\\qquad0.666667] " "disp('\\end{align*}')" "\\end{align*}"
#1="" #1# #1#)<br>
</p>
<p>
Result:
"t=[t(1),t(end)];\ny=[y(1),y(end)];\ndisp('\\begin{align*}')\n\\begin{align*}\nfprintf('t
= [%g \\\\quad%g] \\\\\\\\\\n', t)\nt= [0 \\quad1]
\\\\\nfprintf('y = [%g \\\\qquad%g] \\n', y)\ny= [1
\\qquad0.666667]
\ndisp('\\end{align*}')\n\\end{align*}\n\n\n"<br>
</p>
<p>
Result:
"t=[t(1),t(end)];\ny=[y(1),y(end)];\ndisp('\\begin{align*}')\n\\begin{align*}\nfprintf('t
= [%g \\\\quad%g] \\\\\\\\\\n', t)\nt= [0 \\quad1]
\\\\\nfprintf('y = [%g \\\\qquad%g] \\n', y)\ny= [1
\\qquad0.666667]
\ndisp('\\end{align*}')\n\\end{align*}\n\n\n"<br>
</p>
<p>
Result:
"t=[t(1),t(end)];\ny=[y(1),y(end)];\ndisp('\\begin{align*}')\n\\begin{align*}\nfprintf('t
= [%g \\\\quad%g] \\\\\\\\\\n', t)\nt= [0 \\quad1]
\\\\\nfprintf('y = [%g \\\\qquad%g] \\n', y)\ny= [1
\\qquad0.666667]
\ndisp('\\end{align*}')\n\\end{align*}\n\n\n"<br>
</p>
</div>
</div>
</div>
</div>
<div id="postamble" class="status">
<p class="date">Created: 2017-11-04 Sat 15:26</p>
<p class="validation"><a
href="http://validator.w3.org/check?uri=referer">Validate</a></p>
</div>
<br>
</body>
</html>
|