Create Lookup Table in Matlab
显示 更早的评论
Hi, I want to create lookup table in Matlab that contains angle in radians and power value corresponding to it. The main code will have an angle which will be looked for in the lookup table and return the corresponding power value. I want to use linear interpretation to calculate the angles values that are not present in the table. Can you please help? Thanks
采纳的回答
更多回答(1 个)
Les Beckham
2017-5-13
As Image Analyst said, I think interp1 is the way to go. However, I would just call it with the specific angle for which you want the power value:
currentAngle = pi/4; % for example
currentPower = interp1(angles, powers, currentAngle); % returns the power value corresponding to currentAngle
This, of course, assumes that you know the power values (powers) for some specific set of angle values (angles). These two known vectors constitute your lookup table. Check the doc for interp1 for more info.
类别
在 帮助中心 和 File Exchange 中查找有关 Lookup Tables 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!