Sum of a signal in simulink
조회 수: 49 (최근 30일)
이전 댓글 표시
In my Simulink model, current value of a signal should be added to all previous value of the same signal. I've used integrator with initial value of zero to find it; however the result is different from what I find in Matlab through "sum" or "trapz" function. The solver is continuous with fixed step size. Any thought to resolve this issue. or any other block to use for this purpose instead of integrator?
댓글 수: 0
채택된 답변
Azzi Abdelmalek
2015년 8월 4일
편집: Azzi Abdelmalek
2015년 8월 4일
function y=fcn(u)
persistent a
if isempty(a)
a=0
end
y=u+a;
a=y;
You can also use a discrete transfer function 1/(z-1)
댓글 수: 1
추가 답변 (1개)
Sean de Wolski
2015년 8월 4일
You could also use a unit delay:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/177918/image.png)
댓글 수: 1
Azzi Abdelmalek
2015년 8월 4일
He is asking for all previous values. This will calculate out(n)+out(n-1)
참고 항목
카테고리
Help Center 및 File Exchange에서 General Applications에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!