Mixture of 2 salts + Dirac
Afficher commentaires plus anciens
%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)')
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Loops and Conditional Statements 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!





