I want to combine two anon functions, p(h) and t(p) and plot them against each other
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Peter M Hogan
am 21 Jan. 2019
Kommentiert: Peter M Hogan
am 24 Jan. 2019
p= 29.921(1-6.8753*10^(-6)*h)^(5.2559)
T=49.161*log(p)+44.932
i want to write a script such that p and t are anon functs and then plot T against h with h from -500 to 14439
0 Kommentare
Akzeptierte Antwort
Stephan
am 21 Jan. 2019
Bearbeitet: Stephan
am 21 Jan. 2019
Hi,
the following code substitutes p in the equation for T with the expression from the first equation and creates a function handle:
syms h T
eq1 = 29.921*(1-6.8753e-6)*h^(5.2559)
eq2 = 49.161*log(p)+44.932
fun = matlabFunction(subs(eq2,p,eq1))
Then you can calculate values for T with given h and plot the result:
hval = linspace(-500,14439,1000);
Tval = fun(hval);
plot(hval,Tval)
Best regards
Stephan
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Symbolic Math Toolbox finden Sie in Help Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!