aitizaznu
Newbie level 3
Hi
Following is the serialized matlab code of the cooley tukey algorithm ifft that i want to cosimulate in my Simulink model but i dont get the idea that how to do it.
What necessary steps are additionally required
I learned a lot from demos that
First convert it to fix point ,Then apply hdl coder but:
1) How to assign fix point data types,
2)and can the Matlab complex number multiplication, addition and other arithrematic operation in use can be directly converted to hdl code or not.
p.s the code works perfectly in the simulink model.
The code is given below:
Following is the serialized matlab code of the cooley tukey algorithm ifft that i want to cosimulate in my Simulink model but i dont get the idea that how to do it.
What necessary steps are additionally required
I learned a lot from demos that
First convert it to fix point ,Then apply hdl coder but:
1) How to assign fix point data types,
2)and can the Matlab complex number multiplication, addition and other arithrematic operation in use can be directly converted to hdl code or not.
p.s the code works perfectly in the simulink model.
The code is given below:
Code:
function y = iffxt( u )
b = numerictype(1, 16, 15);
c = numerictype(1, 16, 15);
d = numerictype(1, 16, 15);
e = numerictype(1, 16, 15);
x = numerictype(1, 16, 15);
x = [ u(1);u(2);u(3);1;u(4);u(5);u(6);0;0;u(7);u(8);u(9);-1;u(10);u(11);u(12);];
b = [x(1)+x(9); x(2)+x(10); x(3)+x(11); x(4)+x(12); x(5)+x(13); x(6)+x(14); x(7)+x(15); x(8)+x(16); x(1)-x(9); x(2)-x(10); x(3)-x(11); x(4)-x(12);x(5)-x(13); x(6)-x(14) ;x(7)-x(15); x(8)-x(16);];
c = [ b(1)+b(5); b(2)+b(6); b(3)+b(7); b(4)+b(8); b(1)-b(5); b(2)-b(6); b(3)-b(7); b(4)-b(8); b(9)+b(13)*1j; b(10)+b(14)*1j; b(11)+b(15)*1j; b(12)+b(16)*1j; b(9)+b(13)*-1j; b(10)+b(14)*-1j; b(11)+b(15)*-1j; b(12)+b(16)*-1j;];
d = [ c(3)+c(1); c(4)+c(2); c(1)-c(3); c(2)-c(4); c(5)+c(7)*1j; c(6)+c(8)*1j;c(5)+c(7)*-1j; c(6)+c(8)*-1j; c(9)+c(11)*(.7071+.7071j); c(10)+c(12)*(.7071+.7071j); c(9)+c(11)*(-.7071-.7071j); c(10)+c(12)*(-.7071-.7071j); c(13)+c(15)*(-.7071+.7071j);c(14)+c(16)*(-.7071+.7071j); c(13)+c(15)*(.7071-.7071j);c(14)+c(16)*(.7071-.7071j); ];
e = [ d(1)+d(2); d(1)-d(2); 1i*d(4)+d(3); -1i*d(4)+d(3);d(5)+d(6)*(.7071+.7071j); d(5)+d(6)*(-.7071-.7071j); d(7)+d(8)*(-.7071+.7071j); d(7)+d(8)*(.7071-.7071j); d(9)+d(10)*(.923879532+.382683432j) ; d(9)+d(10)*(-.923879532-.382683432j); d(11)+d(12)*(-.382683432+.923879532j); d(11)+d(12)*(.382683432-.923879532j);d(13)+d(14)*(.382683432+.923879532j); d(13)+d(14)*(-.382683432-.923879532j); d(15)+d(16)*(-.923879532+.382683432j);d(15)+d(16)*(.923879532-.382683432j);];
y = [e(1);e(16);e(8);e(12);e(4);e(14);e(6);e(10);e(2);e(15);e(7);e(11);e(3);e(13);e(5);e(9);]*.0625;
Last edited: