How to extrapolate the data while some data is already supplied on one spine?
Show older comments
Hello,
I'm trying to extrapolate this data, although the results are not correct. I have the following datapoints (red circles, from experimental):

When I extrapolate this with interp1 I get these results:

Apart from the 100% weight fraction ethanol spline, these results are obviously incorrect. How can I do this extrapolation succesfully so the data makes sense?
Here is the code, i commented the extrapolation part out. I feel like there are simpler methods for this extrapolation anyway.
% Solubility 3D graph for aspirin in ethanol and water at different
% temperatures
clear;clc;close all
C_water = [0 0 0 0 0 0.1 0.1 0.1 0.25 0.25 0.25 0.4 0.4 0.4 0.55 0.55 0.55 0.75 0.75 0.75]';
C_ethanol = [1 1 1 1 1 0.9 0.9 0.9 0.75 0.75 0.75 0.6 0.6 0.6 0.45 0.45 0.45 0.25 0.25 0.25]';
Temperature = [60 80 25 35 50 25 35 50 25 35 50 25 35 50 25 35 50 25 35 50]';
C_ASA_motherliquor = [900 1680 237.9 378.4 648.4 283.2 419.1 689.2 266.6 395.3 679.1 186.2 304.8 570.8 87.9 149.5 377 16.2 32.9 101.6]';
C_ethanol_percentage = C_ethanol.*100; % Percentage ethanol in outlet stream
C_ASA_ML_toGrams = C_ASA_motherliquor./1000;
% % Extrapolation
% extr1 = interp1(Temperature(1:3),C_ASA_ML_toGrams(1:3),55:5:80,'spline','extrap');
% extr2 = interp1(Temperature(4:6),C_ASA_ML_toGrams(4:6),55:5:80,'spline','extrap');
% extr3 = interp1(Temperature(7:9),C_ASA_ML_toGrams(7:9),55:5:80,'spline','extrap');
% extr4 = interp1(Temperature(10:12),C_ASA_ML_toGrams(10:12),55:5:80,'spline','extrap');
% extr5 = interp1(Temperature(13:15),C_ASA_ML_toGrams(13:15),55:5:80,'spline','extrap');
% extr6 = interp1(Temperature(16:18),C_ASA_ML_toGrams(16:18),55:5:80,'spline','extrap');
% TemperatureExtr = [55 60 65 70 75 80 55 60 65 70 75 80 55 60 65 70 75 80 55 60 65 70 75 80 55 60 65 70 75 80 55 60 65 70 75 80]';
% C_ASA_ML_toGrams_Extr = [extr1 extr2 extr3 extr4 extr5 extr6]';
% C_ethanol_Extr = [1 1 1 1 1 1 0.9 0.9 0.9 0.9 0.9 0.9 0.75 0.75 0.75 0.75 0.75 0.75 0.6 0.6 0.6 0.6 0.6 0.6 0.45 0.45 0.45 0.45 0.45 0.45 0.25 0.25 0.25 0.25 0.25 0.25]';
% C_ethanol_percentage_Extr = C_ethanol_Extr.*100;
[xq,yq] = meshgrid(0:5:100, 25:5:50);
vq = griddata(C_ethanol_percentage,Temperature,C_ASA_ML_toGrams,xq,yq);
mesh(xq,yq,vq)
hold on
plot3(C_ethanol_percentage,Temperature,C_ASA_ML_toGrams,'ro')
hold on
surf(xq,yq,vq)
% % Add extrapolated data
% hold on
% [xq2,yq2] = meshgrid(0:5:100, 55:5:80);
% vq2 = griddata(C_ethanol_percentage_Extr,TemperatureExtr,C_ASA_ML_toGrams_Extr,xq2,yq2);
% mesh(xq2,yq2,vq2)
% hold on
% plot3(C_ethanol_percentage_Extr,TemperatureExtr,C_ASA_ML_toGrams_Extr,'bo')
% hold on
% surf(xq2,yq2,vq2)
xlabel('weight fraction ethanol [%]')
ylabel('Temperature [Degrees Celsius]')
zlabel('Solubility ASA [g ASA / g solvent]')
Thanks in advance.
Accepted Answer
More Answers (0)
Categories
Find more on Spline Postprocessing in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!