problem with subs function

5 ビュー (過去 30 日間)
Mariam Yehia
Mariam Yehia 2017 年 4 月 21 日
コメント済み: Walter Roberson 2017 年 4 月 21 日
hello here is my program....it substitutes the value for the first run only; then the symbols appear again!
syms La Lb Lc
Ia=(20+6*La+.02*La^2);
Ib=(25+5.5*Lb);
Ic=(20+6.5*Lc+.005*Lc^2);
IHRa=diff(Ia,La)
IHRc=diff(Ic,Lc)
for L=0:10:90
if L<=30
Lb=L
else
Lb=30;
b=L-Lb
ihr_a=subs(IHRa,La,b)
ihr_c=subs(IHRc,Lc,b)
p=ihr_a-ihr_c
end
end
  1 件のコメント
Walter Roberson
Walter Roberson 2017 年 4 月 21 日
When I try, I appear to get substituted values each time.
I am not sure what you mean by "the first run". Your "if L<=30" statement is true for L = 0, 10, 20, and 30, and in those cases the only action you request is Lb=L .
Perhaps your "end" for your "if" is too late? Should it be
for L=0:10:90
if L<=30
Lb=L
else
Lb=30;
end
b=L-Lb
ihr_a=subs(IHRa,La,b)
ihr_c=subs(IHRc,Lc,b)
p=ihr_a-ihr_c
end

サインインしてコメントする。

回答 (0 件)

カテゴリ

Help Center および File ExchangeSymbolic Math Toolbox についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by