As your plot looks like a simple linear interpolation, you could use
fitfun=@(x) interp1(x2,y2,x,'linear');
to define a function fitfun(x)
. Then just call this function with your new x2
values, I think it should work directly with the array (the result will be an array of the same size):
newy2=fitfun(newx2);
Watch out for the bounds: interpolation can't give you points outside the domain set by x2
, unless you tell it what to say (default out-of-bounds value is NaN
, I think)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.