problem with subs function

5 Ansichten (letzte 30 Tage)
Mariam Yehia
Mariam Yehia am 21 Apr. 2017
Kommentiert: Walter Roberson am 21 Apr. 2017
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 Kommentar
Walter Roberson
Walter Roberson am 21 Apr. 2017
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

Melden Sie sich an, um zu kommentieren.

Antworten (0)

Kategorien

Mehr zu Symbolic Math Toolbox finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by