Convert (x,y) data into a function y => f(x)
43 次查看(过去 30 天)
显示 更早的评论
To whom it may concern:
It is one of those days when apparent simple tasks seem hard for some reason.
I have a continues but highly non smooth dataset of emissivity versus wavelength. I would really like to put this into a (lookup) function so the my dataset (lamda, e), i.e.,
Lamda e
0.25 0.545
0.26 0.556
0.27 0.654
…etc will turn into a function e = f(lamda). This would be very helpful since I can then create a function handle and integrate over certain wavelength regions and perform other operations.
Any suggestions???
0 个评论
采纳的回答
Matt Fig
2012-12-14
You could use POLYFIT, or the curve fitting toolbox or a simple interpolation.
>> x = 0:.25:5;
>> y = x.^2;
>> f = @(z) interp1(x,y,z); % Lookup table function
>> x2 = 1/8:1/8:5; % Just to compare func to data.
>> plot(x,y,'sb',x2,f(x2),'*r')
更多回答(1 个)
Jing
2012-12-13
Hi Jaap, I can't fully understand your question. Do you mean you want a lookup table in function form? If so, you can use fitting process(The fitting highly depends on the fit type your use) to build a function, but the function may not be very accurate at each data point.
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Biological and Health Sciences 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!