What is wrong with my function?

function LinearOperator
set S=data
for t=S(:,1)
if t=1 then ViOld=0
else set ViOld=S(t,2)
end
set Qi=S(t,3)
end
k=1:length(t)
set ViNew(t,k)=alpha*ViOld*(t-1)+(1-alpha)Qi(t)
set ViOld=ViNew
set t=t+1
end
end

댓글 수: 1

Explorer
Explorer 2016년 3월 8일
The way you have written code in question is not correct. Edit it, select the code only and select code option.

답변 (1개)

Walter Roberson
Walter Roberson 2016년 3월 8일

0 개 추천

The first operand to set() must be a graphics handle or object handle, not a string such as 'S=data'
MATLAB does not use 'set' in assignments. Just remove the word 'set' from your code.

댓글 수: 2

Walter Roberson
Walter Roberson 2016년 3월 8일
Also, tests use == not =
Isabel Rojas-Ferrer
Isabel Rojas-Ferrer 2016년 3월 13일
Thank you, that was really helpful.

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

제품

질문:

2016년 3월 8일

마감:

2021년 8월 20일

Community Treasure Hunt

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

Start Hunting!

Translated by