Effacer les filtres
Effacer les filtres

Ignoring a set of values

3 vues (au cours des 30 derniers jours)
Ethan Boyce
Ethan Boyce le 26 Août 2020
Commenté : Ethan Boyce le 26 Août 2020
I need to ignore the second values returned for my subsequent functions. In other words, for the values of t_max, I need to keep 10.27 and ignore 129.72
close all
clear all
syms t b r;
%Profit equation
P = (200+b*t)*(0.65-0.01*r*t+0.00004*t^2)-0.45*t;
%Best time to sell
dPdt = simplify(vpa(diff(P, t)))
sym_t_max =simplify(vpa(solve(diff(P, t), t)))
t_max = simplify(subs(sym_t_max, {b, r}, {5,1}))
P_max = simplify(subs(P, {t,b,r}, {t_max, 5,1}))

Réponse acceptée

esat gulhan
esat gulhan le 26 Août 2020
Try this
close all
clear all
syms t b r;
%Profit equation
P = (200+b*t)*(0.65-0.01*r*t+0.00004*t^2)-0.45*t;
%Best time to sell
dPdt = simplify(vpa(diff(P, t)));
sym_t_max =simplify(vpa(solve(diff(P, t), t)));
t_max = simplify(subs(sym_t_max, {b, r}, {5,1}));
P_max = simplify(subs(P, {t,b,r}, {t_max, 5,1}));
t_max(1)
P_max(1)
  1 commentaire
Ethan Boyce
Ethan Boyce le 26 Août 2020
Wooow, another point to me for making things much more complex than they need to be. Thank you!

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Loops and Conditional Statements 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!

Translated by