Turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page

11-09-2016 04:50 AM

Options

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report to a Moderator

Hi, I would like to solve a non linear differential equation on labview. Does anyone know how to do?

The equation is the following:

dx=[**A-BC**/(2D)]x + (**B**/2D)*[**(C**x)^2+4*D*p]^0.50

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.

x is the vector of variables.

Thanks for your attention.

Solved! Go to Solution.

11-09-2016 07:22 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report to a Moderator

I recommend you check out Mathematica or another programming language __designed__ for these types of problems. LabVIEW is designed to create Virtual Instruments for handling __engineering__ problems, such as Control, Data Acquisition, and Communication.

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 ...

Bob Schor

11-09-2016 10:23 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report to a Moderator

The resolution of this equation can be done using the "ODE Solver.vi" in LabVIEW. You can look at this example:

C:\Program Files (x86)\National Instruments\LabVIEW 2016\examples\Mathematics\Differential Equations - ODE\ODE-PredatorPrey.vi

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.

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:

C:\Program Files (x86)\National Instruments\LabVIEW 2016\examples\Control and Simulation\Case Studies\Nonlinear\Pendulum\SimEx Nonlinear and Linear Pendulum Simulation.vi

Or if you want to preserve the equation, you can use Formula Node as this example below:

C:\Program Files (x86)\National Instruments\LabVIEW 2016\examples\Control and Simulation\Case Studies\Nonlinear\van der Pol\Van der Pol.vi

Or use Mathscript:

C:\Program Files (x86)\National Instruments\LabVIEW 2016\examples\Control and Simulation\Case Studies\Aerospace\Quadcopter\Quadcopter Dynamics and Control.vi

And, by the way, **LabVIEW was enhanced to solve this problem** that you requested and he is very powerful in several mathematics operations.

Hopefully this can help you....

11-10-2016 05:44 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report to a Moderator

Thanks for your answer.

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.

Thank for your attention.

Solution

Accepted by topic author antosch

11-10-2016 10:24 AM - edited 11-10-2016 10:28 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report to a Moderator

To make the ODE solver to work you matrices and vectors, you need to "pack" the data into the variant:

and then, unpack using the structure below (the math below is just a demonstration and I did not try to solve your problem):

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):

http://zone.ni.com/reference/en-XX/help/373123C-01/lvtextmath/msfunc_ode_rk45/

% The lorenz function is defined by:

% function DY = lorenz(times, y)

% DY = zeros(3, 1);

% DY(1) = 10*(y(2)-y(1));

% DY(2) = 28*y(1)-y(2)-y(1)*y(3);

% DY(3) = y(1)*y(2)-8/3*y(3);

[T, Y] = ode_rk45('lorenz', [0, 5], [1; 1; 1])

odepset('AbsTol', 1E-3, 'MinStep', 1E-8, 'MaxStep', 1)

[T2, Y2] = ode_rk45('lorenz', [0, 5], [1; 1; 1])

options = odepset

[T3, Y3] = ode_rk45('lorenz', [0, 5], [1; 1; 1], options)

Hopefully this helps a bit more to solve your problem.