problem with subs function
4 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
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 Commento
Walter Roberson
il 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
Risposte (0)
Vedere anche
Categorie
Scopri di più su Symbolic Math Toolbox in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!