find intersection of refline and function
显示 更早的评论
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.

回答(1 个)
Star Strider
2017-10-6
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 个评论
Thomas Janss
2017-10-6
编辑:Thomas Janss
2017-10-6
Star Strider
2017-10-6
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)
类别
在 帮助中心 和 File Exchange 中查找有关 Characters and Strings 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!