Sum of a signal in simulink

21 ビュー (過去 30 日間)
Sam136
Sam136 2015 年 8 月 4 日
編集済み: Yeow Yu Leong 2024 年 6 月 9 日
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?

採用された回答

Azzi Abdelmalek
Azzi Abdelmalek 2015 年 8 月 4 日
編集済み: Azzi Abdelmalek 2015 年 8 月 4 日
You can use a Matlab function block with this code
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 件のコメント
Yeow Yu Leong
Yeow Yu Leong 2024 年 6 月 9 日
編集済み: Yeow Yu Leong 2024 年 6 月 9 日
or use an accumulator

サインインしてコメントする。

その他の回答 (1 件)

Sean de Wolski
Sean de Wolski 2015 年 8 月 4 日
You could also use a unit delay:
  1 件のコメント
Azzi Abdelmalek
Azzi Abdelmalek 2015 年 8 月 4 日
He is asking for all previous values. This will calculate out(n)+out(n-1)

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeSimulink についてさらに検索

タグ

製品

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by