Info

이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.

i need help in this matlab code

조회 수: 1 (최근 30일)
ayoub maa
ayoub maa 2018년 12월 17일
마감: MATLAB Answer Bot 2021년 8월 20일
I want to calculate this function
X(i,j)=teta(1,0)*x(i-1,j)+teta(0,1)*x(i,j-1),and teta are parametre unknown this is my code
p1=1;
p2=1;
teta=size(x);
for i=p1+1:m
for j=p2+1:n
X(i,j)= teta(1,0)*x(i-1,j)+teta(0,1)*x(i,j-1);
end
end
I have this message:
Subscript indices must either be real positive integers or logicals.
Error in Untitled2 (line 68)
X(i,j)= teta(1,0)*x(i-1,j)+teta(0,1)*x(i,j-1);

답변 (1개)

John D'Errico
John D'Errico 2018년 12월 17일
편집: John D'Errico 2018년 12월 17일
READ THE ERROR MESSAGE. Then look at your code. teta is a variable, correct? What is this?
teta(1,0)
How about this?
teta(0,1)
So if teta is a variable, then teta(1,0) is an index operation into that variable. Now, go back and read the error message again.
MATLAB does not support a zero based index origin. The FIRST element in an array is at index 1.

이 질문은 마감되었습니다.

Community Treasure Hunt

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

Start Hunting!

Translated by