This video explains how to design a stateflow chart to calculate the sum of factorial of first N natural numbers. N is a positive integer taken as an input.
You can view below videos where it is shown how to compute just the factorial of Nth number.
Below video shows the steps to compute Factorial in MATLAB and Stateflow:
https://youtu.be/vfNeja8Id2g
Below video shows the steps to compute Factorial in Simulink:
https://youtu.be/d1GSGUukU-o
We will be glad to hear from you regarding any query, suggestions or appreciations at: programmerworld1990@gmail.com
Source code:
function outputArg = Factorial_Sum(inputArg)
outputArg = 0;
for i = 1:inputArg
outputArg = outputArg + factorial(i);
endend