How to interpolate an intermediate curve from curves with different number of data points?

3 views (last 30 days)
Hello
See the attached picture. The picture shows 4 stress-strain curves, each curve is for a different temperature. What I want is to approximate a curve for 60 deg Celsius. How do I do this? I think there will be lots of problems stemming from that each curve stop at a different strain. I have looked at this question ( https://stackoverflow.com/questions/23494254/interpolation-between-two-curves-matlab?fbclid=IwAR1XKpmOxYtRmd1Zibe6zo4hNRNJAXI2NhC8ByFx-V4HmzQ2XiUl9GTn-Vg ) and answer but I dont think it will give me what I want.

Answers (1)

KSSV
KSSV on 8 Sep 2020
data = xlsread("Data.xlsx") ;
t = data(:,1) ;
strain = data(:,2) ;
stress = data(:,3) ;
%
[c,ia,ib] = unique(t) ;
N = length(c) ;
x = cell(N,1) ;
y = cell(N,1) ;
z = cell(N,1) ;
for i = 1:N
x{i} = strain(ib==i) ;
y{i} = stress(ib==i) ;
z{i} = t(ib==i) ;
end
% Make all cells to same size and into a matrix
Y = zeros(N,100) ;
for i = 1:N
xi = x{i} ; yi = y{i} ;
xxi = linspace(x{end}(1),x{4}(end),100) ;
yyi = interp1(xi,yi,xxi) ;
yyi(isnan(yyi)) = yi(end) ;
Y(i,:) = yyi ;
end
X = repmat(xxi,4,1) ;
Z = repmat(c,1,100) ;
% use contour
contour(X,Y,Z)
colorbar

Community Treasure Hunt

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

Start Hunting!