Mixture of 2 salts + Dirac
Show older comments
%I'm doing the Mixture of 2 salts equation and I would to like to add a
%dirac with the purpose in the real life to add just once 2lb of salt in this
%tank.
%So basically, I have a constat flow going in and out to this tank, and I
%want to add 2lb of salt in this tank just one time and I need do it with
%the dirac delta function.
syms A(t) y
%f = diff(A) == Kin * A
%dsolve(f)
% k*A = the solution concentration
% A: amount of salt k: amount of water
Kin = 3;
Ain = 2;
Kout = 3;
Ain = Kin*Ain;
Aout = Kout * (A/300);
x=0:15;
idx = y == Inf;
y(idx) = 1;
% After 5 minutes 2 lb the salt will be added just once.
f1 = diff(A) == (Ain - Aout) + (2 * dirac(x-5))
S = dsolve(f1)
S1 = dsolve(S,A(0)==50,t)
plot(x,S,'o-')
title 'Mixture of 2 salts'
xlabel ('Time (min)')
ylabel ('Amount of Salt (lb)')
Accepted Answer
More Answers (0)
Categories
Find more on Loops and Conditional Statements 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!




