How to produce a scatter plot with smooth line for this plot?
11 次查看（过去 30 天）
Ashvinder Singh Gill Surmaish Singh Gill 2020-5-24
Attached is the capture.png which shows the desired smooth plot that I would like to have. FYP Sample Data.PNG is what I have been getting through the codes below but I need smooth plot just like the one produced in Capture.png.
Can anyone guide how can I produce scatter plot with smooth lines please similar to the Capture.PNG?
Appreciate if anyone can help me. God Bless You!
data = xlsread("sampleexceldata.xlsx") ;
K = data(1,[1 3 5]) ; % factors
data(1,:) = ;
s1 = data(:,1) ; f1 = data(:,2) ;
s2 = data(:,3) ; f2 = data(:,4) ;
s3 = data(:,5) ; f3 = data(:,6) ;
axis ([0 5 0 90])
axis ([0 5 0 13])
title('Force vs Displacement');
Thiago Henrique Gomes Lobato 2020-5-24
Those smooth lines are interpolations between the given points. For you to have a similar result, what you need to do is find an interpolation that is suitable for your expectations about the data and then simply interpolate before plotting. An simple example can be seen below, where the difference between a linear (default) and cubic interpolation can be seen check interp1:
x = 1:10;
y = (-1).^(x);
xq = 1:0.01:10;
yq = interp1(x,y,xq,'PCHIP') ;