필터 지우기
필터 지우기

Ignoring a set of values

조회 수: 3 (최근 30일)
Ethan Boyce
Ethan Boyce 2020년 8월 26일
댓글: Ethan Boyce 2020년 8월 26일
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}))

채택된 답변

esat gulhan
esat gulhan 2020년 8월 26일
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
Ethan Boyce
Ethan Boyce 2020년 8월 26일
Wooow, another point to me for making things much more complex than they need to be. Thank you!

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by