y(k + 2) = 0.25y(k), y(0) = 0, y(1) =1 (b). Write a Matlab script that solves y(k) pointwise for k =0,1,2,…,10. Ruun the program and verify that the solution is in accordance

3 ビュー (過去 30 日間)
pirya devi
pirya devi 2022 年 9 月 27 日
コメント済み: John D'Errico 2022 年 9 月 27 日
how can I solve this question any idea. new to Matlab.

回答 (1 件)

Torsten
Torsten 2022 年 9 月 27 日
Initialize y(1) = 0, y(2) = 1 and use a for-loop to calculate y(k+2) starting with k = 1 and ending with k = 9.
  3 件のコメント
Torsten
Torsten 2022 年 9 月 27 日
y(0) = 0, y(1) =1
And since MATLAB's array indices start at 1, not at 0, you must start with y(1) and y(2) instead of y(0) and y(1).
John D'Errico
John D'Errico 2022 年 9 月 27 日
You ask why initialize y(1) and y(2)? The answer is MATLAB does not allow you index an array at 0. The first element of the vector y is y(1), NOT y(0). So you must offset your indices.

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

カテゴリ

Help Center および File ExchangeIntroduction to Installation and Licensing についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by