Attempted to access T(1,0); index must be a positive integer or logical.
Show older comments
I have to create a toeplitz matrix without using the command. my teacher said to start off with something like this. Its for this problem Write a MATLAB routine (that is, a MATLAB function) that produces the finite difference solution ^u. Use a uniform discretization with x = 1=(n+1). (The input to the function should be n, and the output should be the approximate solution ^u.) Plot the approximate solution against the exact solution for n = 3, 7 and 15.
T(1,1)=1
T(1,2)=-1
for i=1:n-2
T(i,i-1)=1;
T(i,1)=-1;
T(i,i+1)=0;
end
It keeps giving me the error -Attempted to access T(1,0); index must be a positive integer or logical.- Anyone have a better idea of how to create this thing?
Accepted Answer
More Answers (0)
Categories
Find more on Loops and Conditional Statements in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!