generate y(n)=y(n-1)+x(n)

284 ビュー (過去 30 日間)
Marwan Malaeb
Marwan Malaeb 2017 年 4 月 20 日
コメント済み: Joshua Iascau 2022 年 4 月 13 日
hello i want to generate y(n)=y(n-1)+x(n). by using a for loop I can find the last value of y, but i need to store all values of y from n =1 till n. Who do I do that?


Azzi Abdelmalek
Azzi Abdelmalek 2017 年 4 月 20 日
y0=0; % Initial conditions
for k=2:n
  1 件のコメント
Marwan Malaeb
Marwan Malaeb 2017 年 4 月 20 日
that is right, thanks Azzi.


その他の回答 (2 件)

Roger Stafford
Roger Stafford 2017 年 4 月 20 日
That is precisely what the matlab ‘cumsum’ function does:
y = cumsum(x);
  1 件のコメント
Joshua Iascau
Joshua Iascau 2022 年 4 月 13 日
you said what?


polat kayhan
polat kayhan 2021 年 5 月 24 日
𝑋𝑛+1 = 𝑋𝑛 2 + 0.25
Information about its relation, calculate the value of its relation for a value of n, register
Write a computer program whose result will be output for n = 0, 5, 10, 15,… communication only.
n = 0,1,2,3,…., 54


Find more on Switches and Breakers in Help Center and File Exchange


Community Treasure Hunt

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

Start Hunting!

Translated by