
Interpolation between intersecting curves
15 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Mikel Spillemaekers
am 19 Mai 2020
Bearbeitet: Ameer Hamza
am 19 Mai 2020
Hello,
For a project I have to do an interpolation between two curves. I have datapoints for both curves:
first curve (x1,y1):
x1=[0.155,0.16,0.165,0.17,0.175,0.18,0.185,0.19,0.195,0.2,0.205,0.21,0.215,0.22,0.225,0.23,0.235,0.24,0.245,0.25,0.255,0.26,0.265,0.27,0.275,0.28,0.285,0.29,0.295,0.3,0.305,0.31,0.315,0.32,0.325,0.33,0.335,0.34,0.345,0.35,0.355,0.36,0.365,0.37,0.375,0.38,0.385,0.39,0.395,0.4,0.405,0.41,0.415,0.42,0.425,0.43,0.435,0.44,0.445,0.45,0.455,0.46,0.465,0.47,0.475,0.48,0.485,0.49,0.495,0.5,0.505,0.51,0.515,0.52,0.525,0.53,0.535,0.54,0.545,0.55,0.555,0.56,0.565,0.57,0.575,0.58,0.585,0.59,0.595,0.6,0.605,0.61,0.615,0.62,0.625,0.63,0.635,0.64,0.645,0.65,0.655,0.66,0.665,0.67,0.675,0.68,0.685,0.69,0.695,0.7,0.705,0.71,0.715,0.72,0.725,0.73,0.735,0.74,0.745,0.75,0.755,0.76,0.765,0.77,0.775,0.78,0.785,0.79,0.795,0.8,0.805,0.81,0.815,0.82,0.825,0.83,0.835,0.84,0.845,0.85,0.855,0.86,0.865,0.87,0.875,0.88,0.885,0.89,0.895,0.9,0.905,0.91,0.915,0.92,0.925,0.93,0.935,0.94,0.945,0.95,0.955,0.96,0.965,0.97,0.975,0.98,0.985,0.99,0.995,1];
y1=[0.749,0.743,0.736,0.729,0.723,0.717,0.708,0.7,0.693,0.686,0.679,0.675,0.671,0.667,0.663,0.658,0.653,0.648,0.643,0.638,0.633,0.63,0.626,0.623,0.619,0.616,0.612,0.609,0.606,0.603,0.6,0.597,0.594,0.591,0.588,0.585,0.582,0.579,0.577,0.574,0.571,0.569,0.567,0.564,0.562,0.56,0.558,0.556,0.553,0.551,0.55,0.549,0.547,0.546,0.545,0.543,0.542,0.541,0.539,0.538,0.537,0.536,0.535,0.534,0.534,0.533,0.532,0.531,0.53,0.53,0.529,0.529,0.528,0.528,0.527,0.526,0.526,0.525,0.525,0.524,0.524,0.524,0.524,0.524,0.523,0.523,0.523,0.523,0.523,0.523,0.523,0.523,0.523,0.523,0.523,0.523,0.523,0.523,0.523,0.523,0.523,0.523,0.523,0.523,0.523,0.523,0.523,0.523,0.523,0.524,0.525,0.525,0.526,0.526,0.527,0.527,0.528,0.529,0.529,0.53,0.531,0.532,0.532,0.533,0.534,0.534,0.535,0.536,0.537,0.538,0.538,0.539,0.54,0.541,0.542,0.542,0.543,0.544,0.545,0.546,0.546,0.547,0.548,0.549,0.55,0.551,0.552,0.553,0.553,0.554,0.555,0.556,0.557,0.558,0.559,0.56,0.561,0.562,0.562,0.563,0.564,0.565,0.566,0.567,0.568,0.569,0.57,0.571,0.572,0.572];
and second curve (x2,y2):
x2=[0.305,0.31,0.315,0.32,0.325,0.33,0.335,0.34,0.345,0.35,0.355,0.36,0.365,0.37,0.375,0.38,0.385,0.39,0.395,0.4,0.405,0.41,0.415,0.42,0.425,0.43,0.435,0.44,0.445,0.45,0.455,0.46,0.465,0.47,0.475,0.48,0.485,0.49,0.495,0.5,0.505,0.51,0.515,0.52,0.525,0.53,0.535,0.54,0.545,0.55,0.555,0.56,0.565,0.57,0.575,0.58,0.585,0.59,0.595,0.6,0.605,0.61,0.615,0.62,0.625,0.63,0.635,0.64,0.645,0.65,0.655,0.66,0.665,0.67,0.675,0.68,0.685,0.69,0.695,0.7,0.705,0.71,0.715,0.72,0.725,0.73,0.735,0.74,0.745,0.75,0.755,0.76,0.765,0.77,0.775,0.78,0.785,0.79,0.795,0.8,0.805,0.81,0.815,0.82,0.825,0.83,0.835,0.84,0.845,0.85];
y2=[0.695,0.694,0.692,0.691,0.69,0.689,0.688,0.686,0.685,0.684,0.683,0.682,0.681,0.68,0.678,0.677,0.675,0.674,0.673,0.671,0.67,0.669,0.667,0.666,0.665,0.663,0.662,0.661,0.66,0.659,0.658,0.657,0.656,0.655,0.654,0.653,0.652,0.651,0.65,0.649,0.649,0.648,0.647,0.646,0.645,0.644,0.643,0.642,0.641,0.641,0.641,0.64,0.64,0.64,0.639,0.639,0.639,0.638,0.638,0.638,0.637,0.636,0.636,0.635,0.634,0.633,0.633,0.632,0.632,0.632,0.632,0.632,0.632,0.632,0.632,0.632,0.632,0.632,0.632,0.631,0.631,0.631,0.631,0.631,0.631,0.631,0.631,0.631,0.631,0.63,0.631,0.631,0.631,0.631,0.631,0.631,0.631,0.632,0.632,0.632,0.633,0.633,0.633,0.634,0.634,0.635,0.636,0.636,0.637,0.638];
The curve with points (x1,y1) are fuel consumption points of an aircraft engine with Bypass-ratio of 13. The curve with points (x1,y1) are fuel consumption points of an aircraft engine with Bypass-ratio of 8.5. I need to interpolate the curves to obtain a bypass-ratio of 12. So I'm not looking for mid-value of both curves, but it should ten more towards the (x1,y1) points.
I tried some stuff like interpolating the individual curves first, to obtain a nicer set of data, but then I get stuck on interpolating between the curves.
Hope someone can help,
PS: sorry for the ugly and long data set
Mikel
0 Kommentare
Akzeptierte Antwort
Ameer Hamza
am 19 Mai 2020
Bearbeitet: Ameer Hamza
am 19 Mai 2020
Try this
x1=[0.155,0.16,0.165,0.17,0.175,0.18,0.185,0.19,0.195,0.2,0.205,0.21,0.215,0.22,0.225,0.23,0.235,0.24,0.245,0.25,0.255,0.26,0.265,0.27,0.275,0.28,0.285,0.29,0.295,0.3,0.305,0.31,0.315,0.32,0.325,0.33,0.335,0.34,0.345,0.35,0.355,0.36,0.365,0.37,0.375,0.38,0.385,0.39,0.395,0.4,0.405,0.41,0.415,0.42,0.425,0.43,0.435,0.44,0.445,0.45,0.455,0.46,0.465,0.47,0.475,0.48,0.485,0.49,0.495,0.5,0.505,0.51,0.515,0.52,0.525,0.53,0.535,0.54,0.545,0.55,0.555,0.56,0.565,0.57,0.575,0.58,0.585,0.59,0.595,0.6,0.605,0.61,0.615,0.62,0.625,0.63,0.635,0.64,0.645,0.65,0.655,0.66,0.665,0.67,0.675,0.68,0.685,0.69,0.695,0.7,0.705,0.71,0.715,0.72,0.725,0.73,0.735,0.74,0.745,0.75,0.755,0.76,0.765,0.77,0.775,0.78,0.785,0.79,0.795,0.8,0.805,0.81,0.815,0.82,0.825,0.83,0.835,0.84,0.845,0.85,0.855,0.86,0.865,0.87,0.875,0.88,0.885,0.89,0.895,0.9,0.905,0.91,0.915,0.92,0.925,0.93,0.935,0.94,0.945,0.95,0.955,0.96,0.965,0.97,0.975,0.98,0.985,0.99,0.995,1];
y1=[0.749,0.743,0.736,0.729,0.723,0.717,0.708,0.7,0.693,0.686,0.679,0.675,0.671,0.667,0.663,0.658,0.653,0.648,0.643,0.638,0.633,0.63,0.626,0.623,0.619,0.616,0.612,0.609,0.606,0.603,0.6,0.597,0.594,0.591,0.588,0.585,0.582,0.579,0.577,0.574,0.571,0.569,0.567,0.564,0.562,0.56,0.558,0.556,0.553,0.551,0.55,0.549,0.547,0.546,0.545,0.543,0.542,0.541,0.539,0.538,0.537,0.536,0.535,0.534,0.534,0.533,0.532,0.531,0.53,0.53,0.529,0.529,0.528,0.528,0.527,0.526,0.526,0.525,0.525,0.524,0.524,0.524,0.524,0.524,0.523,0.523,0.523,0.523,0.523,0.523,0.523,0.523,0.523,0.523,0.523,0.523,0.523,0.523,0.523,0.523,0.523,0.523,0.523,0.523,0.523,0.523,0.523,0.523,0.523,0.524,0.525,0.525,0.526,0.526,0.527,0.527,0.528,0.529,0.529,0.53,0.531,0.532,0.532,0.533,0.534,0.534,0.535,0.536,0.537,0.538,0.538,0.539,0.54,0.541,0.542,0.542,0.543,0.544,0.545,0.546,0.546,0.547,0.548,0.549,0.55,0.551,0.552,0.553,0.553,0.554,0.555,0.556,0.557,0.558,0.559,0.56,0.561,0.562,0.562,0.563,0.564,0.565,0.566,0.567,0.568,0.569,0.57,0.571,0.572,0.572];
ratio1 = 13;
x2=[0.305,0.31,0.315,0.32,0.325,0.33,0.335,0.34,0.345,0.35,0.355,0.36,0.365,0.37,0.375,0.38,0.385,0.39,0.395,0.4,0.405,0.41,0.415,0.42,0.425,0.43,0.435,0.44,0.445,0.45,0.455,0.46,0.465,0.47,0.475,0.48,0.485,0.49,0.495,0.5,0.505,0.51,0.515,0.52,0.525,0.53,0.535,0.54,0.545,0.55,0.555,0.56,0.565,0.57,0.575,0.58,0.585,0.59,0.595,0.6,0.605,0.61,0.615,0.62,0.625,0.63,0.635,0.64,0.645,0.65,0.655,0.66,0.665,0.67,0.675,0.68,0.685,0.69,0.695,0.7,0.705,0.71,0.715,0.72,0.725,0.73,0.735,0.74,0.745,0.75,0.755,0.76,0.765,0.77,0.775,0.78,0.785,0.79,0.795,0.8,0.805,0.81,0.815,0.82,0.825,0.83,0.835,0.84,0.845,0.85];
y2=[0.695,0.694,0.692,0.691,0.69,0.689,0.688,0.686,0.685,0.684,0.683,0.682,0.681,0.68,0.678,0.677,0.675,0.674,0.673,0.671,0.67,0.669,0.667,0.666,0.665,0.663,0.662,0.661,0.66,0.659,0.658,0.657,0.656,0.655,0.654,0.653,0.652,0.651,0.65,0.649,0.649,0.648,0.647,0.646,0.645,0.644,0.643,0.642,0.641,0.641,0.641,0.64,0.64,0.64,0.639,0.639,0.639,0.638,0.638,0.638,0.637,0.636,0.636,0.635,0.634,0.633,0.633,0.632,0.632,0.632,0.632,0.632,0.632,0.632,0.632,0.632,0.632,0.632,0.632,0.631,0.631,0.631,0.631,0.631,0.631,0.631,0.631,0.631,0.631,0.63,0.631,0.631,0.631,0.631,0.631,0.631,0.631,0.632,0.632,0.632,0.633,0.633,0.633,0.634,0.634,0.635,0.636,0.636,0.637,0.638];
ratio2 = 8.5;
% first interpolating signal1 to be of same length as signal2
x1_new = x2; % same x values as x2
y1_new = interp1(x1, y1, x1_new);
ratiox = 12;
x3 = x2; % same x values as x1_new and x2
y3 = interp1([ratio1 ratio2], [y1_new; y2], ratiox);
hold on
plot(x1_new, y1_new, 'DisplayName', 'ratio=13');
plot(x2, y2, 'DisplayName', 'ratio=8.5');
plot(x3, y3, 'DisplayName', 'ratio=12'); % values at ratio=12
legend

0 Kommentare
Weitere Antworten (1)
David Hill
am 19 Mai 2020
f=fit(x1',y1','poly5');
g=fit(x2',y2','poly5');
x=min(x2):.01:max(x2);
h=1/4.5*(g(x)-f(x))+f(x);%only good for minimum x-range established by data (x2)
0 Kommentare
Siehe auch
Kategorien
Mehr zu Get Started with Curve Fitting Toolbox 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!