Intercept of two polynomial of degree 2 graphs

조회 수: 5 (최근 30일)
Alexander Abadom
Alexander Abadom 2020년 4월 15일
댓글: darova 2020년 4월 15일
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에서 Interpolation에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by