Clear Filters
Clear Filters

How to choose lag value dde23 (lags)

9 views (last 30 days)
Leo
Leo on 25 Nov 2013
Answered: Chin Wan Elijah on 26 Aug 2014
Hello,
I am attempting to get to grips with dde23 (and the ode solvers for that matter).
System being modeled: An oscillating force is applied to a piston which pressurises a liquid until a valve opens. Within the piston is a bag of gas which has a varying pressure and volume (this bag allows the piston to move even if valves are closed).
The system of equations are as follows:
% y1 = position
% y2 = velocity
% y3 = volume
% y1' = velocity
% y2' = acceleration = sum of forces / mass
% y3' = change in volume with respect to time = change in volume/ change in time
y1 ' = y2
y2' =(7.3e5 + 2e5*sin(t)-1.9e5./max(0.0733,min(Z(3)-((y(1)-Z(1))*0.12),0.1))^1.4*0.12)/6.7e5
if y3 > 0.1
y3' = 0
elseif y3 < 0.0733
y3' = 0
else 0.0733 < y3 < 0.1
y3' = -((y(1)-Z(1))*0.12)/lag
end
The issue: I feel like provided the time lag is small enough to capture changes in variables and large enough that rounding errors do not affect results, different lags should give the same results. however that is not the case and I cannot decide what lag to use. The following image shows the results for position (top axis) and volume (bottom axis). As you can see the results vary a lot in this small range of lags and also the location of the lines are not predictable.
lag=0.01 % middle line
lag=0.011 % top line
lag=0.012 % middle line
lag=0.013 % bottom line
lag=0.014 % middle line
lag=0.015 % middle line

Answers (2)

Leo
Leo on 10 Jan 2014
I think I understand dde's a bit better now and it seems they are not applicable to a continuous kind of problem, such as above. The delay should be exact; for example a plane coming in to land can gauge the distance to the runway by sending a signal to bounce off a target. By the time the signal has returned the information it gives is the distance from target an exact time ago.
I am now attempting to use ode45 for this problem by passing solutions of previous time steps (using OutputFcn) to be used to calculate the current time step.

Chin Wan Elijah
Chin Wan Elijah on 26 Aug 2014
I think it's 'dde23' that has constant lag, if you want to use continuous lags, you may want to use other function more information from here:http://www.mathworks.co.uk/help/matlab/delay-differential-equations.html

Categories

Find more on Programming in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!