Using ode45 application to solve a problem involving salt concentration levels.
Afficher commentaires plus anciens
I am working on a problem in MATLAB in which I need to determine specific values of time and flow rate from the following DE problem.

I have a function coded for the given dQ/dt equation:
function saltrate=salt_level(t,Q);
saltrate=r/4-(r*Q)/100;
end
I am lost though as to how to apply the function to find the specific values the problem is asking for. Any help would be most appreciated!
Thanks in advance, Ryan
2 commentaires
The ode45 documentation is pretty helpful. https://www.mathworks.com/help/matlab/ref/ode45.html
tspan = [0 5];
Q0 = 0;
[t,Q] = ode45(@salt_level, tspan, Q0);
plot(t,Q);
You are just going to use this same code (I modified the variables) except set your time span and initial conditions appropriately.
Just make sure you define all constants like r and Q_l in the function salt_level. Also, I think your differential equation is wrong. It just gives a line.
Ryan Kerby
le 27 Juin 2017
Réponses (0)
Catégories
En savoir plus sur Ordinary Differential Equations dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!