# fixed point taylor sine/cosine approximation model

조회 수: 7(최근 30일)
Gary 2022년 6월 19일
댓글: Gary 2022년 7월 17일
Can anybody share sine/cosine taylor approx model which is compatible with hdl coder?
##### 댓글 수: 2표시숨기기 이전 댓글 수: 1
Gary 2022년 6월 21일
I do not wish to use the inbuilt model of simulink but to build one.

댓글을 달려면 로그인하십시오.

### 답변(2개)

Sulaymon Eshkabilov 2022년 6월 19일
WHy not to use matlab's built-in taylor() expansion fcn: https://www.mathworks.com/help/symbolic/sym.taylor.html?s_tid=doc_ta
E.g.:
syms x
taylor(sin(x), x, pi)
ans = taylor(cos(x), x, pi/2)
ans = ##### 댓글 수: 20표시숨기기 이전 댓글 수: 19
Gary 2022년 6월 23일
Thank you . It was excellent analysis. I am clear now.

댓글을 달려면 로그인하십시오.

Kiran Kintali 2022년 7월 4일
HDL Coder supports code generation for single precision trigonometric functions.
Getting Started with HDL Coder Native Floating-Point Support
Taylor series approximation using HDL Coder
If you want to build Taylor series approximation by youself you could build using basic Math operations and sufficient amount of fixed-point conversion.
syms x
f = sin(x);
T2sin = taylor(f, x, 'Order', 2); % T2sin = x
T4sin = taylor(f, x, 'Order', 4); % T4sin = -x^3/6 + x
T6sin = taylor(f, x, 'Order', 6); % T6sin = x^5/120 - x^3/6 + x On you build such a model you can further use optimizations such as multiplier partitioning, resource sharing and pipelining options to optimize the model for area/performance/latency/power.
##### 댓글 수: 2표시숨기기 이전 댓글 수: 1
Gary 2022년 7월 17일
I managed to get 3 digits accuracy sine/cosine using chebhyshev polynomials(order 3). Thank you for sharing all the resources

댓글을 달려면 로그인하십시오.

R2014a

### Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!