How do you generate conditional output for a multi-variable hyperbolic function given changing slope?

9 views (last 30 days)
I’ve been able to calculate q for t = 0:14399 and b = 1:0.1:2 simultaneously, however, I would like to control the calculation of q subject to several constraints (listed below). I’ve tried a number of methods and have yet to figure this out. Any and all help would be much appreciated. The constrains I want to impose on the function are below and my code is below that.
Thanks in advance!
Constraints
If qt-1 < qab then qt = 0, otherwise:
for (qt / qt-1) -1*360 < = -0.05 --> q = hyperdecline(qi,B,di,T)
for (qt / qt-1) -1*360 > -0.05 --> q = qt-1 * (1-dt/360)
Code
hyperdecline function
function q = hyperdecline(qi,B,di,T)
q = qi*(1+B.*di.*T).^(-1./B);
%INPUTS
% qi = IP rate (initial 24-hr production rate)
% di = initial decline rate (nominal)
% b = B-factor (constant)
% t = time period range (normally days) from 0 to n
% qab = production abandonment rate
% dt = terminal decline rate (exponential)
%OUTPUTS
% q = production at time t
% qcum = cumulative production at time t
% qm = monthly aggregation of q data using
% Type curve inputs
qi = 20000;
di=.01;
b=1:0.1:2;
t = 0:14399;
qab=500;
dt=.05;
% Curve Calculations
[T B] = ndgrid(t,b); % Create grid of t and b values to iterate over
q = hyperdecline(qi,B,di,T);
qcum = cumsum(q);
qm = squeeze(sum(reshape(q',size(b,2),30,[]),2))'; % Aggregate q into 30 day months

Answers (0)

Categories

Find more on Interpolation 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!