Unrecognized variable x error
1 次查看(过去 30 天)
显示 更早的评论
for k=n-1:1
x(n)=cnew(n)/dnew(n)
x(k)=(cnew(k)-a(k)*x(k+1))/d(k)
end
Tnew(i,j)=x(i)
P.S. cnew and all others are known.
Still while running this i am getting an error-
Unrecognized function or variable 'x'.
Error in ADI (line 51)
Tnew(i,j)=x(i)
0 个评论
采纳的回答
Cris LaPierre
2020-9-25
编辑:Cris LaPierre
2020-9-26
What is the value of n?
The most obvious thing to me is that your for loop doesn't actually run, so x is never created.
The loops don't run because you start at k=n-1 and ends when k=1. You're not getting an error that your index has to be positive, so n>=2. If x is not created at all, that means n>=3, causing to loop indices to be 2:1, resulting in an empty array, which means your loop never runs.
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Entering Commands 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!