What is wrong with this sequence?

I was given this code to figure out what is wrong with it, but cannot figure it out.
if true
% code
% Evaluate a sequence
% x_i = 4 * x_i-1 + 2 * x_i - 2
x = zeros(1,30);
x(1) = 10;
x(2) = 20;
for k = 1:length(x);
x(k) = 2.*x(k-2)-3.*x(k-1);
end
end

댓글 수: 1

Cedric
Cedric 2015년 8월 11일
편집: Cedric 2015년 8월 11일
What happens when k is equal to 1 or 2 ?

댓글을 달려면 로그인하십시오.

답변 (1개)

Azzi Abdelmalek
Azzi Abdelmalek 2015년 8월 11일
편집: Azzi Abdelmalek 2015년 8월 11일

0 개 추천

When k=1, k-2 is negative, and k-1 is equal to zero

카테고리

도움말 센터File Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기

제품

태그

질문:

2015년 8월 11일

편집:

2015년 8월 11일

Community Treasure Hunt

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

Start Hunting!

Translated by