How i do my RMS function on Embedded Matlab Function
Show older comments
Hello.
I need to create my RMS block to use with simulink. This is the first part of a protection relay project. So i'll test many algoritms to do this. I already did this on m-file project but im want to do this a dinamic mode.
I've read about of coder.extrinsic.
Example:
% Mann & Morrison algoritm
f0=60;
w=2*pi*f0;
b=(1/w)^2;
c=1/sqrt(2);
fs=32*f0; % sample frenq. 32 sample per cycle.
dt=1/fs;
der=(I(n) - I(n-2))/(2*dt); %I is a imput (sine wave block)
Ief(n-1)=c*(sqrt(I(n-1)^2 + b*(der)^2)); %Ief is a RMS value at sample n
n=n+1;
I dont know how i work with arrays on the function block. I need a buffer?
Thanks
Accepted Answer
More Answers (0)
Categories
Find more on General Applications in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!