Reputation:
I want to model a for loop system in Simulink, how I can model the following MATLAB syntax into Simulink model?
N=3;
for i=0:1:N
sum(i+1)=factorial(i)/factorial(N);
end
I have tried for loop sub systems in Simulink and also Sum block for iteration loop but doesn't help me. factorial function can be calculated with FCN function. Suggest me the ways to resolve this model with step time.
Upvotes: 0
Views: 996
Reputation: 1316
If you have the code already in matlab use a embedded matlab function to implement it i your simulink model. This is in general quite efficient since it will be compiled (compared to interpreted matlab function blocks)
Upvotes: 0