How can I code this system of differential equations?

1 view (last 30 days)
I'm trying to punch in my system of equations, but I'm having a really rough time making sense of Matlab. I'll explain the system here:
I'm currently working on a project wherein I have to code a system of differential equations. My system is based on plants. I'm determining that L(t) is going to be the length of the plant, and dL/dt is the rate at which the plant grows over time. Here's what the equation (thus far) looks like:
dL/dt = aL(L initial - L final)
My professor suggested some alterations, and said that this would be a bit better:
L’=a(S+W+N)(1-1/k)
Where S,W,N stand for sun, water, and nutrients respectively and k is the max height of the plant. He then suggested I could figure out responsible equations for derivative of S, W, and N. He imagined maybe something like this but I’m not sure:
N’= aL
W’=E+bL+cR
S’=dL where d is constant
Where L is the length of the plant, E is the evaporation and R is the water that comes in from rain.
Then R’= a step function that is 0 most of the time and K and certain time intervals that you determine. A similar structure can be used for S’ I think.
Any help is greatly appreciated - I'm just having trouble figuring out how I can punch it into matlab.
Here's what I have so far: I added random numbers for the time being to act as filler.
function dLdt = first_order (L,t)
a = 1;
L0 = 3; %inches
Lf = 6; %inches
S = 6; % hours of sunlight
W = 0.1; % liters of water
N = 1; % nutrients
k = 1;
L'= a(S+W+N)*(1-1/k);
dLdt = aL(L0-Lf)
end

Answers (0)

Categories

Find more on Robust Control Toolbox 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!