topic Re: Solve non linear differential equation on Labview in LabVIEW
https://forums.ni.com/t5/LabVIEW/Solve-non-linear-differential-equation-on-Labview/m-p/3367414#M991319
<P>Thanks for your answer.</P><P>Do you how to solve the differential equation using "MathScript", because I tried to use "ODE solver.vi" but it doesn't work using matrix or array.</P><P>Thank for your attention.</P>Thu, 10 Nov 2016 11:44:10 GMTantosch2016-11-10T11:44:10ZSolve non linear differential equation on Labview
https://forums.ni.com/t5/LabVIEW/Solve-non-linear-differential-equation-on-Labview/m-p/3366980#M991166
<P>Hi, I would like to solve a non linear differential equation on labview. Does anyone know how to do?<BR />The equation is the following:</P><P>dx=[<STRONG>A-BC</STRONG>/(2D)]x + (<STRONG>B</STRONG>/2D)*[<STRONG>(C</STRONG>x)^2+4*D*p]^0.50<BR />where A is a matrix 6x6, B is a matrix 6x1, C is a matrix 1x6, D is a costant and p is a costant.</P><P>x is the vector of variables.</P><P> </P><P>Thanks for your attention.</P>Wed, 09 Nov 2016 10:50:19 GMThttps://forums.ni.com/t5/LabVIEW/Solve-non-linear-differential-equation-on-Labview/m-p/3366980#M991166antosch2016-11-09T10:50:19ZRe: Solve non linear differential equation on Labview
https://forums.ni.com/t5/LabVIEW/Solve-non-linear-differential-equation-on-Labview/m-p/3366996#M991168
<P>I recommend you check out Mathematica or another programming language <U>designed</U> for these types of problems. LabVIEW is designed to create Virtual Instruments for handling <U>engineering</U> problems, such as Control, Data Acquisition, and Communication.</P><P> </P><P>This is not to say you cannot do non-linear differential equations in LabVIEW, but that it is probably not the most appropriate platform. I also wouldn't suggest that you use BASIC ...</P><P> </P><P>Bob Schor</P>Wed, 09 Nov 2016 13:22:00 GMThttps://forums.ni.com/t5/LabVIEW/Solve-non-linear-differential-equation-on-Labview/m-p/3366996#M991168Bob_Schor2016-11-09T13:22:00ZRe: Solve non linear differential equation on Labview
https://forums.ni.com/t5/LabVIEW/Solve-non-linear-differential-equation-on-Labview/m-p/3367089#M991201
<P>The resolution of this equation can be done using the "ODE Solver.vi" in LabVIEW. You can look at this example: </P>
<P>C:\Program Files (x86)\National Instruments\LabVIEW 2016\examples\Mathematics\Differential Equations - ODE\ODE-PredatorPrey.vi</P>
<P> </P>
<P>Where you need to build a "call back" that describe your equation below (you need to provide the matrices below as an "Variante" for the data input.</P>
<P> </P>
<P>Another option is to use the LabVIEW Control Design and Simulation Module. In using this tool, then you can explitly show the equation and you can see the solving process in each timestep. You cna use this example:</P>
<P> </P>
<P>C:\Program Files (x86)\National Instruments\LabVIEW 2016\examples\Control and Simulation\Case Studies\Nonlinear\Pendulum\SimEx Nonlinear and Linear Pendulum Simulation.vi</P>
<P> </P>
<P>Or if you want to preserve the equation, you can use Formula Node as this example below:</P>
<P>C:\Program Files (x86)\National Instruments\LabVIEW 2016\examples\Control and Simulation\Case Studies\Nonlinear\van der Pol\Van der Pol.vi</P>
<P> </P>
<P>Or use Mathscript:</P>
<P>C:\Program Files (x86)\National Instruments\LabVIEW 2016\examples\Control and Simulation\Case Studies\Aerospace\Quadcopter\Quadcopter Dynamics and Control.vi</P>
<P> </P>
<P>And, by the way, <STRONG>LabVIEW was enhanced to solve this problem</STRONG> that you requested and he is very powerful in several mathematics operations.</P>
<P> </P>
<P>Hopefully this can help you....</P>Wed, 09 Nov 2016 16:23:12 GMThttps://forums.ni.com/t5/LabVIEW/Solve-non-linear-differential-equation-on-Labview/m-p/3367089#M991201Barp2016-11-09T16:23:12ZRe: Solve non linear differential equation on Labview
https://forums.ni.com/t5/LabVIEW/Solve-non-linear-differential-equation-on-Labview/m-p/3367414#M991319
<P>Thanks for your answer.</P><P>Do you how to solve the differential equation using "MathScript", because I tried to use "ODE solver.vi" but it doesn't work using matrix or array.</P><P>Thank for your attention.</P>Thu, 10 Nov 2016 11:44:10 GMThttps://forums.ni.com/t5/LabVIEW/Solve-non-linear-differential-equation-on-Labview/m-p/3367414#M991319antosch2016-11-10T11:44:10ZRe: Solve non linear differential equation on Labview
https://forums.ni.com/t5/LabVIEW/Solve-non-linear-differential-equation-on-Labview/m-p/3367559#M991365
<P>To make the ODE solver to work you matrices and vectors, you need to "pack" the data into the variant:</P>
<P> </P>
<P><IMG src="https://forums.ni.com/t5/image/serverpage/image-id/191156i594854BC6E44F61C/image-size/original?v=v2&px=-1" border="0" alt="pack1.PNG" title="pack1.PNG" /><IMG src="https://forums.ni.com/t5/image/serverpage/image-id/191158i18CB6848B8B58264/image-size/original?v=v2&px=-1" border="0" alt="pack3.PNG" title="pack3.PNG" width="389" height="218" /></P>
<P> </P>
<P> </P>
<P>and then, unpack using the structure below (the math below is just a demonstration and I did not try to solve your problem): </P>
<P><IMG src="https://forums.ni.com/t5/image/serverpage/image-id/191157i5814587C9D8E4628/image-size/original?v=v2&px=-1" border="0" alt="pack2.PNG" title="pack2.PNG" /></P>
<P> </P>
<P>Now, if you want to go in the direction of using Mathscript, here is a page that helps you to understand how to use a ODE solver. notice that, in this case, you need to create a user-defined function (below called lorenz):</P>
<P> </P>
<P><A href="http://zone.ni.com/reference/en-XX/help/373123C-01/lvtextmath/msfunc_ode_rk45/" target="_blank">http://zone.ni.com/reference/en-XX/help/373123C-01/lvtextmath/msfunc_ode_rk45/</A></P>
<H2>Examples</H2>
<P class="Body"><SPAN class="Monospace">% The lorenz function is defined by:</SPAN><BR /><SPAN class="Monospace">% function DY = lorenz(times, y)</SPAN><BR /><SPAN class="Monospace">% DY = zeros(3, 1);</SPAN><BR /><SPAN class="Monospace">% DY(1) = 10*(y(2)-y(1));</SPAN><BR /><SPAN class="Monospace">% DY(2) = 28*y(1)-y(2)-y(1)*y(3);</SPAN><BR /><SPAN class="Monospace">% DY(3) = y(1)*y(2)-8/3*y(3);</SPAN><BR /><SPAN class="Monospace">[T, Y] = ode_rk45('lorenz', [0, 5], [1; 1; 1])</SPAN><BR /><BR /><SPAN class="Monospace">odepset('AbsTol', 1E-3, 'MinStep', 1E-8, 'MaxStep', 1)</SPAN><BR /><SPAN class="Monospace">[T2, Y2] = ode_rk45('lorenz', [0, 5], [1; 1; 1])</SPAN><BR /><BR /><SPAN class="Monospace">options = odepset</SPAN><BR /><SPAN class="Monospace">[T3, Y3] = ode_rk45('lorenz', [0, 5], [1; 1; 1], options)</SPAN></P>
<P> </P>
<P>Hopefully this helps a bit more to solve your problem.</P>
<P> </P>Thu, 10 Nov 2016 16:28:48 GMThttps://forums.ni.com/t5/LabVIEW/Solve-non-linear-differential-equation-on-Labview/m-p/3367559#M991365Barp2016-11-10T16:28:48Z