Hi Stephanie
You can follow the below steps to build the funtion.
Initialize the A matrix and b vector: You will need an N x N matrix A and an N x 1 vector b.
Set up the coefficients in matrix A:
- For the first row (i = 1), set the diagonal element to -2 and the element to the right to 1. The corresponding element in b should account for Tleft.
- For the last row (i = N), set the diagonal element to -2 and the element to the left to 1. The corresponding element in b should account for Tright.
- For the middle rows (2 ≤ i ≤ N-1), set the diagonal element to -2, the element to the left to 1, and the element to the right to 1.
Fill in the b vector:
- The first element in b should be -Tleft.
- The last element in b should be -Tright.
- The middle elements in b should be 0.
Display the results for specific values: If N = 3, Tleft = 5, and Tright = 115, display the A matrix and b vector to verify your results.
Here is a skeleton of the function to guide you:
function [A, b] = makecoeff(N, Tleft, Tright)
Hope this helps!