Interpolating data with specifc / non-consistent "X" values:
5 次查看(过去 30 天)
显示 更早的评论
Hey,
I've got a question that I can't seem to find within MATLAB functions. Right now, I'm trying to get an approximation for sun "yaw" data for a controller I'm trying to design. Right now, I have data at days (beginning from Jul. 15, and day 189 being Jan. 20. )
[1 95 189 277 365]
(If curious, I decided to start experiment after summer solstice happened, and there was only 1 day of sunshine I was free in the Dec. and Jan. months. So, that's why there's not an even split.)
Anyway, using an online suncalc checker, I was able to get yaw angles at each hour on these 5 days, which was nice. However, I'm running into a problem.
My plan initially was to find the polynomial fit for each hour. For instance, at 12:00 on each above day, I have yaw angles:
[56 73 84 66 56]
Now, using Excel, I get the plot in the picture.
My question is how do I generate this plot in MATLAB?
Thanks for any help in advance.
0 个评论
采纳的回答
Dishant Arora
2014-2-20
you can realize the polynomial using polyfit function:
P = polyfit(X, Y, n) % n is the order of the polynomial you want
0 个评论
更多回答(2 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Polynomials 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!