How do I plot my differential equation on Matlab?
4 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Here is my MATLAB code.
syms v(t) t C1
inflow = 3
peri = .4
Vin = 40
outflow = 4
p = .3
qip = p*inflow
p2 = (v)/(Vin+(inflow-outflow)*(t))
qop = p2*outflow
eqn = diff(v) == qip-qop
S = dsolve(eqn);
pretty(S)
Vp = Vin*peri;
tval = 0;
D = Vp-S
Value = subs(D,tval)
C1 = solve(Value)
tval2 = 7;
Value2 = subs(D,tval2)
C2 = solve(Value2)
V = p*(Vin-tval2)+C1*(Vin-tval2)^(4)
I'm trying to plot Vp and V, but whenever I do, the figure just shows a straight line. It should be something like (tval,Vp) and (tval2,V). Please help, thank you!
0 commentaires
Réponses (1)
Star Strider
le 2 Août 2021
Of copurse it’s going to be a straight line!
After evaluating the functions, look at ‘(tval,Vp)’ and ‘(tval2,V)’. They are all constants!
syms v(t) t C1
inflow = 3
peri = .4
Vin = 40
outflow = 4
p = .3
qip = p*inflow
p2 = (v)/(Vin+(inflow-outflow)*(t))
qop = p2*outflow
eqn = diff(v) == qip-qop
S = dsolve(eqn);
pretty(S)
figure
fsurf(S, [-5 5 0 75])
xlabel('Initial Condition')
ylabel('t')
Vp = Vin*peri
tval = 0;
D = Vp-S
Value = subs(D,tval)
C1 = solve(Value)
tval2 = 7;
Value2 = subs(D,tval2)
C2 = solve(Value2)
V = p*(Vin-tval2)+C1*(Vin-tval2)^(4)
.
0 commentaires
Voir également
Catégories
En savoir plus sur Calculus dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!




