QUESTION 4
Q4a Suppose that the boundary condition is now a function of time, such:
Write a Matlab function that sets up the Laplacian matrix L and the boundary condition vector BC when the BCs vary in time. The only differences to Q3b will be the requirement to include time as an input parameter and the BC function will be as specified in Eqn 6. Your function header must be written as
function [L,BC] = MatSet_T(Nr, Nz, rg, zg, tnow, alpha, BCf)
where
• tnow is the time at the current step, which is needed to evaluate the boundary condition function,
• the rest of the input and output are the same as in Q3b
*Hint: You can modify from the function MatSet.m that you have written in Q3b, but you need to include both MatSet.m and MatSet_T.m as two separate MATLAB files.
Q4b Repeat Q3c with the new boundary condition as shown in Eqn (6). Instead of writing the time to set up and solve the system separately, print out the combined time for each different grid. Print to the command window a few sentences comparing the times in Q3c and Q4b, and explain what causes the difference.
Compare the solutions between Q3 and Q4 - are there any differences? What are they and why? Write a few sentences to the command window to answer.
Students succeed in their courses by connecting and communicating with an expert until they receive help on their questions
Consult our trusted tutors.