find intersection of refline and function
Show older comments
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.

Answers (1)
Star Strider
on 6 Oct 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 Comments
Thomas Janss
on 6 Oct 2017
Edited: Thomas Janss
on 6 Oct 2017
Star Strider
on 6 Oct 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)
Categories
Find more on Characters and Strings in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!