Moving Plot over Plot (Type Curve Matching)

6 views (last 30 days)
Billal Aslam
Billal Aslam on 22 Jan 2022
Commented: Billal Aslam on 24 Jan 2022
Hi Guys,
I would like to match my plotted data with a model plot by interactively shifting the plotted data with mouse, then get the coordinate where both value overlay in each of their own coordinate axis (only their shape/curvature is matched). In engineering this is called 'type curve matching', as illustrated below
Note that plotted data and model plot are both on log-log scale.
I have tried using the data as polyline and interactively move ('translate') it to my model plot, however the data polyline shape blows up when I move it (This doesn't happen if you use linear scale).
here is the mininmum working code
load("TCdata.mat")
load("DataArr.mat")
reD_list=[10 20 50 100 200 1000 10000 100000];
for i=1:length(reD_list)
qDd=radbnd_TC.qDd(radbnd_TC.reD==reD_list(i));
tDd=radbnd_TC.tDd(radbnd_TC.reD==reD_list(i));
loglog(tDd,qDd,'LineWidth',2)
xlim([10^-4 10^4])
ylim([0.01 1000])
hold on
grid on
end
hold off
roi = images.roi.Polyline(gca,'Position',Data,'InteractionsAllowed','translate');
addlistener(roi,'ROIMoved',@allevents);
addlistener(roi,'MovingROI',@allevents);
function allevents(src,evt)
evname = evt.EventName;
switch(evname)
case{'MovingROI'}
disp(['ROI moving Previous Position: ' mat2str(evt.PreviousPosition)]);
disp(['ROI moving Current Position: ' mat2str(evt.CurrentPosition)]);
case{'ROIMoved'}
disp(['ROI moved Previous Position: ' mat2str(evt.PreviousPosition)]);
disp(['ROI moved Current Position: ' mat2str(evt.CurrentPosition)]);
pos=evt.CurrentPosition;
save('mpos','pos')
end
end
Note that the data polyline shape breaks when you move it towards the model curve
Any help will be appreciated, many thanks in advance!
Best Regards,
BMA
  1 Comment
Billal Aslam
Billal Aslam on 24 Jan 2022
Note: I found a workaround by plotting in linear cartesian coordinate using the computed log values. However I still curious whether log based translation can be done in Matlab polyline

Sign in to comment.

Answers (0)

Categories

Find more on Geographic Plots in Help Center and File Exchange

Products


Release

R2021b

Community Treasure Hunt

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

Start Hunting!