Getting errors while using fplot
3 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Gregorio Garza Treviño
le 4 Sep 2022
Réponse apportée : Chunru
le 4 Sep 2022
Ive been working on a little assignment, however, when I go to plot the results I get some strange behaviour. I cant add color specififcations, line width specifications, limits, legend, or even a hold off without getting a massive yellow text box saying "Warning: Error updating ParametrizedFunctionLine" and as soon as I delete said things, the message dissapears.
Any idea on how I can fix this?
And the full code is this:
syms v(t) s(t)
g = 9.8;
EQv = diff(v) == -g;
cond = v(0) == 105;
v(t) = dsolve(EQv, cond)
EQs = diff(s) == v(t);
cond = s(0) == 0;
s(t) = dsolve(EQs, cond)
tmax = 150/7
syms vr(t) sr(t)
k = 0.003;
EQv2 = diff(vr) == -g-k*vr;
cond = vr(0) == 105;
vr(t) = dsolve(EQv2,cond)
EQs2 = diff(sr) == vr;
cond = sr(0) == 0
sr(t) = dsolve(EQs2,cond)
fplot(s(t), [0 tmax], 'Color', 'blue', 'LineWidth', 2)
hold on
r = solve(sr(t)==0)
fplot(sr(t),[0 r], 'Color', 'red', 'LineWidth', 2)
legend('Sin resistencia','Con resistencia')
hold off
0 commentaires
Réponse acceptée
Chunru
le 4 Sep 2022
syms v(t) s(t)
g = 9.8;
EQv = diff(v) == -g;
cond = v(0) == 105;
v(t) = dsolve(EQv, cond)
EQs = diff(s) == v(t);
cond = s(0) == 0;
s(t) = dsolve(EQs, cond)
tmax = 150/7
tmax = 21.4286
syms vr(t) sr(t)
k = 0.003;
EQv2 = diff(vr) == -g-k*vr;
cond = vr(0) == 105;
vr(t) = dsolve(EQv2,cond)
EQs2 = diff(sr) == vr;
cond = sr(0) == 0
sr(t) = dsolve(EQs2,cond)
fplot(s(t), [0 tmax], 'Color', 'blue', 'LineWidth', 2)
hold on
r = solve(sr(t)==0)
sr
fplot(sr(t),[0 double(r)], 'Color', 'red', 'LineWidth', 2) % interval should be double to avoid warning
legend('Sin resistencia','Con resistencia')
hold off
0 commentaires
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Formula Manipulation and Simplification 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!