<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xml:base="http://imechanica.org" xmlns:dc="http://purl.org/dc/elements/1.1/">
<channel>
 <title>iMechanica - How to write the transfer function of mechanic systems in C language? - Comments</title>
 <link>http://imechanica.org/node/3156</link>
 <description>Comments for &quot;How to write the transfer function of mechanic systems in C language?&quot;</description>
 <language>en</language>
<item>
 <title>Re: Matlab .m file to C code</title>
 <link>http://imechanica.org/node/3156#comment-7375</link>
 <description>&lt;p&gt;
Xianfeng,
&lt;/p&gt;
&lt;p&gt;
There are several ways to pass parameters in an out of C functions.&amp;nbsp; C passes arguments&amp;nbsp; by value.&amp;nbsp; You can see what that means by running Joe Zachary&amp;#39;s bit of code at
&lt;/p&gt;
&lt;p&gt;
&amp;nbsp;&lt;a href=&quot;http://www.cs.utah.edu/~hamlet/release/lessons/c13/examples/value/value.c#valuec&quot;&gt;http://www.cs.utah.edu/~hamlet/release/lessons/c13/examples/value/value.c#valuec&lt;/a&gt;
&lt;/p&gt;
&lt;p&gt;
Also look at
&lt;/p&gt;
&lt;p&gt;
&amp;nbsp;&lt;a href=&quot;http://www.cs.utah.edu/~hamlet/release/lessons/c13/c13/body-node2.shtml&quot;&gt;http://www.cs.utah.edu/~hamlet/release/lessons/c13/c13/body-node2.shtml&lt;/a&gt;
&lt;/p&gt;
&lt;p&gt;
and the main pages at
&lt;/p&gt;
&lt;p&gt;
&amp;nbsp;&lt;a href=&quot;http://www.cs.utah.edu/~hamlet/&quot;&gt;http://www.cs.utah.edu/~hamlet/&lt;/a&gt; and &lt;a href=&quot;http://www.cs.utah.edu/~hamlet/release/classes/C/contents.shtml&quot;&gt;http://www.cs.utah.edu/~hamlet/release/classes/C/contents.shtml&lt;/a&gt;.
&lt;/p&gt;
&lt;p&gt;
To pass a set of parameters into a function you can create a &lt;a href=&quot;http://www.cs.utah.edu/~hamlet/release/lessons/c27/c27/index.shtml&quot;&gt;struct&lt;/a&gt;.&amp;nbsp; To get a set of modified parameters out &lt;a href=&quot;http://www.cs.utah.edu/~hamlet/release/lessons/c28/c28/node1.shtml&quot;&gt;you can send in a pointer to a struct&lt;/a&gt; .&amp;nbsp; I prefer that approach because of the problematic memory management issues involved in creating structures inside a function and returning them.
&lt;/p&gt;
&lt;p&gt;
I&amp;#39;m not certain how Matlab deals with that issue.
&lt;/p&gt;
&lt;p&gt;
-- Biswajit&amp;nbsp;
&lt;/p&gt;
&lt;p&gt;
&amp;nbsp;
&lt;/p&gt;
&lt;br class=&quot;clear&quot; /&gt;</description>
 <pubDate>Wed, 07 May 2008 17:46:58 -0400</pubDate>
 <dc:creator>Biswajit Banerjee</dc:creator>
 <guid isPermaLink="false">comment 7375 at http://imechanica.org</guid>
</item>
<item>
 <title>Matlab .m file to C code</title>
 <link>http://imechanica.org/node/3156#comment-7370</link>
 <description>&lt;p&gt;
hi&amp;nbsp; Biswajit,
&lt;/p&gt;
&lt;p&gt;
&amp;nbsp;
&lt;/p&gt;
&lt;p&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; Thank you very much for your suggestions. I also prefer your choice, but I have no idea about that now, so I am going to try mcc first. Thanks again!
&lt;/p&gt;
&lt;p&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; Another question is:
&lt;/p&gt;
&lt;p&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; If I want to give one input parameter to this&amp;nbsp; C code Model,&amp;nbsp; do I get one output with asssumption that there are one input parameter and one output parameter in the model, while not one series of input parameters and one series of output parameters?
&lt;/p&gt;
&lt;p&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;
&amp;nbsp;
&lt;/p&gt;
&lt;p&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; (I don&amp;#39;t know why I can&amp;#39;t post the comment, I tried several times :)
&lt;/p&gt;
&lt;p&gt;
--Xianfeng Ye
&lt;/p&gt;
&lt;br class=&quot;clear&quot; /&gt;</description>
 <pubDate>Wed, 07 May 2008 04:27:56 -0400</pubDate>
 <dc:creator>Xianfeng Ye</dc:creator>
 <guid isPermaLink="false">comment 7370 at http://imechanica.org</guid>
</item>
<item>
 <title>Welcome back, Biswajit!</title>
 <link>http://imechanica.org/node/3156#comment-7350</link>
 <description>&lt;p&gt;Dear Biswajit:&amp;nbsp; So delighted to hear from you again!&amp;nbsp; Hope all is well with you.&amp;nbsp; You must be delighted to see the &lt;a href=&quot;http://imechanica.org/node/2381#comment-7333&quot;&gt;post by Andy Norris&lt;/a&gt;  yesterday, inspired by the jClub theme led by you.&amp;nbsp; We miss you and your thoughtful posts.&lt;/p&gt;
&lt;br class=&quot;clear&quot; /&gt;</description>
 <pubDate>Tue, 06 May 2008 07:28:18 -0400</pubDate>
 <dc:creator>Zhigang Suo</dc:creator>
 <guid isPermaLink="false">comment 7350 at http://imechanica.org</guid>
</item>
<item>
 <title>Welcome back</title>
 <link>http://imechanica.org/node/3156#comment-7348</link>
 <description>&lt;p&gt;
&lt;font size=&quot;2&quot;&gt;Hi Biswajit,&lt;/font&gt;
&lt;/p&gt;
&lt;p&gt;
Welcome back, you have been missed in this forum!&amp;nbsp;
&lt;/p&gt;
&lt;br class=&quot;clear&quot; /&gt;</description>
 <pubDate>Tue, 06 May 2008 07:14:15 -0400</pubDate>
 <dc:creator>Temesgen Markos</dc:creator>
 <guid isPermaLink="false">comment 7348 at http://imechanica.org</guid>
</item>
<item>
 <title>Matlab to C</title>
 <link>http://imechanica.org/node/3156#comment-7345</link>
 <description>&lt;p&gt;
If you are happy with crappy looking code then I would suggest trying
&lt;/p&gt;
&lt;p&gt;
&amp;nbsp;mcc -c myfile
&lt;/p&gt;
&lt;p&gt;
You can find more information at
&lt;/p&gt;
&lt;p&gt;
&lt;a href=&quot;http://www.kluid.com/mlib/viewtopic.php?t=115&quot;&gt;http://www.kluid.com/mlib/viewtopic.php?t=115&lt;/a&gt;
&lt;/p&gt;
&lt;p&gt;
My personal perefernece has been to write a new c version based on the Matlab version.
&lt;/p&gt;
&lt;p&gt;
-- Biswajit&amp;nbsp;
&lt;/p&gt;
&lt;p&gt;
&amp;nbsp;
&lt;/p&gt;
&lt;p&gt;
&amp;nbsp;
&lt;/p&gt;
&lt;br class=&quot;clear&quot; /&gt;</description>
 <pubDate>Tue, 06 May 2008 02:28:54 -0400</pubDate>
 <dc:creator>Biswajit Banerjee</dc:creator>
 <guid isPermaLink="false">comment 7345 at http://imechanica.org</guid>
</item>
<item>
 <title>How to write the transfer function of mechanic systems in C language?</title>
 <link>http://imechanica.org/node/3156</link>
 <description>&lt;p&gt;I have finished building the transfer function model&amp;nbsp;of mechanic systems in MATLAB.&amp;nbsp; But now if I&amp;nbsp;am going&amp;nbsp;to write the model in C language, what could I do? Any hints, fire are welcome!&lt;/p&gt;
&lt;br class=&quot;clear&quot; /&gt;</description>
 <comments>http://imechanica.org/node/3156#comments</comments>
 <category domain="http://imechanica.org/taxonomy/term/135">tip</category>
 <pubDate>Mon, 05 May 2008 22:08:07 -0400</pubDate>
 <dc:creator>Xianfeng Ye</dc:creator>
 <guid isPermaLink="false">3156 at http://imechanica.org</guid>
</item>
</channel>
</rss>
