Solving Equation Generated by pchipinterp method
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
Hi,
I have an array of data which I fitted a curve to using the fit function and pchipinterp method, generating a cfit variable. I know that the line y = (a specific scalar value) will cross the fitted line/function 4 times. How can I solve for those 4 x-coordinates given a specific y-value? Thanks.
0 Kommentare
Antworten (1)
John D'Errico
am 8 Okt. 2020
Bearbeitet: John D'Errico
am 8 Okt. 2020
The simplest way to do this is to use my SLM toolbox.
x = sort(rand(1,20));
y = rand(1,20);
spl = pchip(x,y);
fnplt(spl)
yline(0.3);
What are the x locations where this curve crosses 0.3? There should be 7 such points based on what we see in the figure.
xsol = slmsolve(spl,0.3)
xsol =
Columns 1 through 4
0.0856060691907258 0.179689798032185 0.287680862853776 0.374467025155671
Columns 5 through 7
0.637324302388667 0.644738455928051 0.984815754063193
You can download my SLM toolbox from the File Exchange, here:
0 Kommentare
Siehe auch
Kategorien
Mehr zu Fit Postprocessing finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!