So I am currently working on converting an FEM simulation which was first coded in MatLab (easy testing) into C, in order to improve frame rates, etc.
Now of course C isn't nearly as math friendly. A certain portion of the code has some fairly hairy integrals, which were solved at run time by the MatLab version. As opposed to implementing a numerical solution in C, I had the idea of producing the analytical solution (simple algebra) in Matlab and dumping this over to C. However there is some issue between notations, for example:
In Matlab the following expression:
is equivalent toCode:Ke = [ 16000/94354/a*b ]
note that 'b' is actually in the numerator. Now if the solution was as simple as this it would be no problem to convert, however the actual solution is an 8x8 matrix of expressions like:Code:16000*b/(94354*a)
So my question is, does anyone know exactly how the matlab notation works, or a relatively straightforward way of converting it to an equivalently evaluated C expression?Code:1/2*(1/2*depth/a^2/b^2/(1-NU^2)*NU+1/2*depth/a^2/b^2/(1-NU^2)* (1/2-1/2*NU))*a^2-1/2*depth/b^2/(1-NU^2)*NU-1/2*depth/b^2/(1-NU^2)* (1/2-1/2*NU))*b^2+(-1/2*depth/b/a^2/(1-NU^2)*NU-1/2*depth/a^2/b/(1-NU^2) *(1/2-1/2*NU))*a^2*b+depth/(1-NU^2)*NU+depth/(1-NU^2)*(1/2-1/2*NU)
Any help is appreciated! (Note that changing the ^2 is quite easy)