LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

solving ODE with variable input

Hi I want to solve an  ordinary differential equation describing an output of a simple

RC-lowpassfilter with variable inputvoltage, but I don't want to use the Control Design and Simulation Module, but

the odesolvers like Euler.

 

The differential equation describing the output voltage is in thís case  R*C*u' + u = E(t), where E(t) is the appplied voltage.

 

In the help section, it says that I can use variables but I don't know how to put it in.

 

greatful for some help.

 

Kindest regards,

 

Lasse

 

0 Kudos
Message 1 of 8
(3,432 Views)

Hi again this is what I've done so far.

I've put in x´= Slide -x,

I've also tried to replace the Slide-variable with a constant. it doesn't work either.

 

 

Hoping for some help.

Kindest regards,

Lasse

Download All
0 Kudos
Message 2 of 8
(3,415 Views)

Hi Lasse,

 

there's an example for yur function. Have you looked at it?

 

Try something like this:

check.png

For two variables you need two formulas and 2 startpoints in the X0-array.

Why did you wire the slide to it's local variable? How should the Euler function know about it? LabVIEW isn't a symbolic formula solver, so writing "Slide" in the formula array is nonsense...

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 3 of 8
(3,404 Views)

What kind of array-function do you have there?

Can I exchange the slider to a signal generator?It looks like you have the slider together with initial conditions. This is not

want I want really.

I would like to have x' = Arbitrary signal - x

 

regards,

Lasse

 

0 Kudos
Message 4 of 8
(3,396 Views)

Hi again, I think I am on my way  to implement your solution though it is not what I want.

 

The equation x´= Slider -x describes the responce of an RC-filter, where the slide is the source voltage,and I would like it to have an timevarying arbitray waveform, that's why I've put a slider hoping to be able to set the stop time to infinity, so that I can vary the slider during execution.

 

I have problems experimenting with the one you suggested GerdW. I don't know what I am doing wrong.

 

Kindest regards,

Lasse

 

 

0 Kudos
Message 5 of 8
(3,388 Views)

Lasse,

 

Errors are your friend, but only if you use them and learn from them.

 

Connect an indicator to the error terminal of the ODE Euler Method.vi and you will get an error.  When you check the help for that error, it will tell you that an input was bad.  Then you read the detailed help for the ODE VI you find that the X, F(x,t) and X0 arrays must all be of the same length.  The way you have the Insert into Array wired, the X0 array is longer than the other two, generating the error.

 

Replace the Insert into Array (which causes the array to grow) with Replace Array Subset (which keeps the array the same size) and the error goes away.

 

To see what happens as you move the slide, the whole thing needs to be inside a loop.

 

To see meaningful results on the graph, transpose the data.  The Euler data comes out in two columns and many rows.  The graph is looking for data in two rows.  Actually, an XY graph might be better since you have a Times array as well as the X(t) and Y(t) outputs from the solver.

 

Lynn

 

Message 6 of 8
(3,377 Views)

Can someone save last vi in labview 9.0f3, because I have the same problem but I can't see the solution. Thanks in advance

0 Kudos
Message 7 of 8
(2,887 Views)

Hi cvetangeorgiev,

 

you know there is a Version Conversion board for that purpose?

 

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 8 of 8
(2,883 Views)