Menu

[Solved]Function File Implicitsolverm Write Function Named Implicitsolver Function Definition Line Q37230925

Function file: ImplicitSolver.m

Write a function named ImplicitSolver that hasa function definition line, an H1 line and appropriate helpcomments to define your inputs, outputs, and how to use yourfunction.

Inputs to your function must include:

  • The number of space (position) nodes (M)
  • The number of time steps (N)

The energy generated ( ̇)

  • The time step (∆ )
  • A vector of initial conditions of the temperature at each spacenode at = 0
  • The boundary condition for node 1 as a number (1, 2, 3, or4)
  • A boundary condition parameter for node 1 where the values sentinto the function depends on the type of the chosen boundarycondition o For BC 1, the value sent to the function must be o For BC 2, the value sent to the function must be o For BC 3, the value sent to the function must be 0o For BC 4, the value sent to the function must be [ℎ , ∞] as a vector
  • The boundary condition for node M as a number (1, 2, 3, or4)
  • A boundary condition parameter for node M where the valuesdepend on the type of chosen boundary condition
  • For BC 1, the value sent to the function must be
  • For BC 2, the value sent to the function must be
  • For BC 3, the value sent to the function must be 0
  • For BC 4, the value sent to the function must be[ℎ , ∞] as a vector
  • Any other inputs you deem necessary.

Outputs from the function must include:

  • The temperature distribution over time, ( , ), as a 2D arrayof × elements where each column corresponds to the temperaturedistribution at a single instant in time.

In your function, solve the implicit finite different methodusing the required inputs. This can be done with the followingmethod:

  1. Initializing the first column in your temperature distributionmatrix, ( , ), with the initial condition vector defining thetemperature at the initial time, = 0.
  2. Creating a × matrix A and × 1 vectorb using the coefficients for each internal nodefrom equation 917 and the coefficients for the appropriate boundaryconditions (may be different for node 1 versus node M). Thetemperatures used in either the coefficients or the vectorb is that at the previous time .
  3. Solving the system of equations to find the next set oftemperatures, +1. Store your new set of temperaturesin the next column of ( , ).
  4. Then using the solution just obtained as , tosolve the system of equations to find the next set of temperaturesfor +.
  5. The process is repeated until the temperature at every timestep is estimated. Always store your new set of temperatures in thenext column of ( , ).

****Please use Matlab****

Expert Answer


Answer to Function file: ImplicitSolver.m Write a function named ImplicitSolver that has a function definition line, an H1 line an… . . .

OR


Leave a Reply

Your email address will not be published. Required fields are marked *