How would I test which curve a linear line intersects with first?

2 views (last 30 days)
Essentially, I have three functions; y = 1 + nx, y = m, and y = bx^2, where n, m, and b all vary with user-inputted values.
y = bx^2 is already plotted. At a point A, this plot "stops" and the curve y = m is plotted from the end of that plot.
If the y = 1+ nx curve would intersect with y = m first, then the y = bx^2 curve would have to continue until it intersects with y = 1 + nx.
Essentially what I'm attempting to do is write a program, that when the user inputs values such as planform area and maximum lift coefficient, plots a V-n diagram, with gust lines and all. I've already gotten the code without accounting for the gust lines, but now I'm running into a little bit of trouble.
I'm not asking you to write my code for me, but perhaps a kick in the right direction would be nice. It's been a very long time since I took a MatLab course, and the instruction I received was minimal at best.
Thanks for your help.

Accepted Answer

Matt J
Matt J on 27 Jan 2013
Edited: Matt J on 27 Jan 2013
Your question isn't really a MATLAB question, but rather an algebra question - i.e., how to find the intersection of two plots. To find the intersection of plots y = m, and y = bx^2 set the y's from each plot equal to each other, e..g,
b*x^2=m
or
b*x^2-m=0
Now it's just a matter of finding the roots of a polynomial, which you can do with
>> roots([b,-m,0])

More Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!