Using ode45 application to solve a problem involving salt concentration levels.

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 Comments

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.
Thank you, Joshua!
I had gone through the ode45 doc, but I was not seeing how to really apply it to find a specific variable. I had not thought about using a plot and referencing the data from there.
And I am not particularly concerned if the DE is wrong, as long as I can provide the answers for the information given. The professor is somewhat lenient about that.

Sign in to comment.

Answers (0)

Asked:

on 27 Jun 2017

Commented:

on 27 Jun 2017

Community Treasure Hunt

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

Start Hunting!