How do I compare two graphs for X value at a specific point?

3 views (last 30 days)
Ashik Rahman on 27 Mar 2021
Edited: Ashik Rahman on 1 Apr 2021
I have two dataset that gives plots as below. My goal is to match them and get the x value at a certain point. I have been trying interpolation but isn't getting the result I want. Your help is appreciated.
Star Strider on 28 Mar 2021
The plots in the two images not only appear to have no independent or dependent variable values in common, they actually appear to orders-of-magnitude different.

dpb on 28 Mar 2021
Edited: dpb on 28 Mar 2021
Well, as Star Strider says, the disparity in orders of magnitude between the two makes one truly wonder just how they're supposed to have been related to each other somehow -- but, presuming there is some reason it might make sense, here's the simplest stab at it --
[b,S,mu]=polyfit(ind,refVt5,9); % NB: badly scaled, a 9th deg polynomial is very sensitive
tiledlayout(2,1),hAx=nexttile,plot(ind,refVt5) % plot raw data first
hAx.YDir="reverse";
ylim([2.2 2.7])
Vhat=polyval(b,ind,S,mu); % evaluate the polynomial on refV
hold(hAx,'on');hL=plot(hAx,ind,Vhat,'.r'); % add to the plot
hAx(2)=nexttile;
plot(XX,YY)
% the engine
Xhat=interp1([XX(1);XX(end)],[ind(1);ind(end)],XX); % scale standard curve ranges to
Yhat=interp1([YY(1);YY(end)],[Vhat(1);Vhat(end)],YY); % those of experimental data
hL(2)=plot(hAx(1),Xhat,Yhat,'.k-'); % plot on top of experimental data
legend(hAx(1),'refVt5','fitVt5','Scaled STD')
results in There a little similarity in that both are concave, but that's about as much as can be said for a linear scaling.
Is there any physical model that could be used to predict some functional form that could aid in justifying some nonlinear scaling operation?
dpb on 28 Mar 2021
"the actual experimental curve data is concave downward rather than upward"
One way one might deal with that would be something like --
refVt5Flip=refVt5-refVt5(1); % difference from first point of curve
refVt5Flip=refVt5(1)-refVt5Flip; % switch sign difference relative first point
will give the reflection of the original curve about the initial point in the y direction. Then can plot both curves on same axes with same curvature.
Again, it is totally unknown as to whether any of this makes any sense to do or not with no klew about what these data might represent and, therefore, why such a reflection might be expected as well as the tremendous scale factor differences.
If I do that on the lower of the two previous plots, the result is\ which makes the two look more similar in shape on the larger scale y axes. One might then try simply computing the mean difference between the two and using that to adjust one or the other.
This again, of course, still uses the linear transformation/scaling of the x axis to get the two on the same scale with all the assumptions that implies.

R2020a

Community Treasure Hunt

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

Start Hunting!