find intersection of refline and function
Mostrar comentarios más antiguos
How do I find the point of intersection? i am now getting:
Undefined operator '-' for input arguments of type 'matlab.graphics.primitive.Line'.
Error in jetengine (line 66)
fun=Umix2 - Intersection;
------
Umix1=UNasa(Tref,Sp(iSp1))*YiO2+UNasa(Tref,Sp(iSp2))*YiN2+UNasa(Tref,Sp(iSp5))*YiFuel
Umix2=UNasa(T,Sp(iSp1))*YiO2+UNasa(T,Sp(iSp2))*YiN2+UNasa(T,Sp(iSp5))*YiFuel;
plot(T,Umix2)
hold on
plot(T,Umix1)
hold off
Intersection=refline(0,Umix1);
fun=Umix2 - Intersection;
x = fzero(fun,300)
----
The function is Umix2, the horizontal line is Intersection.

Respuestas (1)
Star Strider
el 6 de Oct. de 2017
Since I don’t have your data, this is just a guess:
Umix2_fun = @(T) UNasa(T,Sp(iSp1))*YiO2+UNasa(T,Sp(iSp2))*YiN2+UNasa(T,Sp(iSp5))*YiFuel;
x = fzero(@(T) Umix2_fun - Umix1, 300)
NOTE — This is obviously UNTESTED CODE. It will probably work.
2 comentarios
Thomas Janss
el 6 de Oct. de 2017
Editada: Thomas Janss
el 6 de Oct. de 2017
Star Strider
el 6 de Oct. de 2017
That’s the problem of not being able to completely test code before posting it.
Try this:
Umix2_fun = @(T) UNasa(T,Sp(iSp1))*YiO2+UNasa(T,Sp(iSp2))*YiN2+UNasa(T,Sp(iSp5))*YiFuel;
x = fzero(@(T) Umix2_fun(T) - Umix1, 300)
Categorías
Más información sobre Characters and Strings en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!