Implementing custom Matlab functions in Simulink
Posted
by niko
on Stack Overflow
See other posts from Stack Overflow
or by niko
Published on 2010-04-28T13:03:35Z
Indexed on
2010/04/29
1:17 UTC
Read the original article
Hit count: 349
Hi,
I would like to use custom Matlab function in Simulink. So far I have done it by placing Embedded Matlab Fuction block. However if the custom function contains another custom function the compile process fails.
Here is the example of function I am trying to embed in the simulation:
function [c, d, iterationsCount] = decodeLDPC(y, H, variance)
Lci = initializeLq(y, H, variance);
Lr = getLr(Lci);
[Lq, c] = getLq(Lci, H, Lr);
iterationsCount = 1;
while(sum(mod(c * H', 2)) ~= 0)
Lr = getLr(Lq);
[Lq, c] = getLq(Lq, H, Lr);
iterationsCount = iterationsCount + 1;
end;
G = getGeneratorMatrix(H);
d = c/G;
where initializeLq and getLr are custom functions as well.
I would be very thankful if anyone could suggest a method to implement the above function in the simulation.
Thank you.
© Stack Overflow or respective owner