Intercept of two polynomial of degree 2 graphs

3 次查看(过去 30 天)
i plotted two graphs, then using 'fit' function i interpolated to polynomial degree two. i can see the point of interception. But i want a function that wil calculate the values of X & Y at which both graphs inrecepts.
See the matlab code and the graph
%Plot the Q-H, Q-P, Q-n graph from the data set.
X1=xlsread('PAT Raw Lab data_plot.xlsx','N2:N331'); % x-axis column for time duration in weeks
Y1=xlsread('PAT Raw Lab data_plot.xlsx','O2:O331');
Z1=xlsread('PAT Raw Lab data_plot.xlsx','R2:R331');
Z2=xlsread('PAT Raw Lab data_plot.xlsx','S2:S331');% y-axis column for weekly ave windspeed (m/s)
figure(1)
f1=fit(X1,Y1,'poly2');
f2=fit(X1,Z2,'poly2');
yyaxis left
p1=plot (f1,X1,Y1,'c*');
ylabel ('Head (H)');
hold on
yyaxis right
p2=plot(f2,X1,Z2,'b*');
hold off
title (' Q-H, & Q-n Characteristic Curve');
xlabel ('Discharge (Q)');
ylabel ('Efficiency (n)');
legend ('Q-H data','Poly deg2 curve','Q-n','Poly deg2 curve');
Please, how can i get the corresponding value of the interception on the Y and X axis?

回答(1 个)

darova
darova 2020-4-15
Try this (not tested)
  2 个评论
Alexander Abadom
Alexander Abadom 2020-4-15
编辑:darova 2020-4-15
Please see the result of running your advice
>> g1=fsolve(@(x)f1(x)-f2(x),6);
No solution found.
fsolve stopped because the problem appears regular as measured by the gradient,
but the vector of function values is not near zero as measured by the
default value of the function tolerance.
<stopping criteria details>
However, from the graph i attached i can see that the fit curve intercepts but i need the exact point with accuracy of where it intercepts???
darova
darova 2020-4-15
Didn't realized that you have 2 different Y axes. It's because the curves don't intersect actuallly

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Polynomials 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by