Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Please provide code for the following matlab problem: In this problem, you will be asked to write a program that implements the finite-difference technique in
Please provide code for the following matlab problem:
In this problem, you will be asked to write a program that implements the finite-difference technique in order to solve Laplace's equation for a square with voltage applied to one side. A good reference for this problem can be found here: http://www.public.iastate.edu/rakmitra/aero361/design_web/Laplace.pdf This problem is an example of the Dirichlet Problem shown in the reference above. a) Begin by defining the simulation grid for this problem. This can be as large as you want but for this problem, let's define the grid to be 50 x 50. Hint: You will need a simulation grid for the voltage at the current iteration and a voltage at the previous iteration of the problem. To define the grid in MATLAB, make 2 empty matrices by using the zeros function (each voltage grid should be one unit larger than the simulation grid in each dimension) b) Now, apply 10 V to one side of the current voltage matrix. You can do this by changing one row c) Following the reference above, compute the maximum error between the current iteration matrix d) Now, apply the algorithm in equation 14 and recalculate the maximum error. Continue computing e) Plot the voltage matrix by using the imagesc function in MATLAB. Attach a screenshot of the plot. of the matrix to 10. and the previous iteration matrix. equation 14 until the maximum error is below 0.01. f) Plot the electric field distribution by first computing the gradient of the voltage matrix, then by using the quiver function to plot the vector function. Attach a screenshot of the plot. g) Repeat steps b)-f) but this time, change the constant 10 V applied to one side to a voltage distribution represented by 10* rowNumber* (1-rowNumber). This can be applied in MATLAB with the following code: rowNum-1:1: xDim+1; V_now (rowNum, yDim+1)-10((rowNum-1) /xDim) . * (1-(rowNum-1)/xDim)); In this problem, you will be asked to write a program that implements the finite-difference technique in order to solve Laplace's equation for a square with voltage applied to one side. A good reference for this problem can be found here: http://www.public.iastate.edu/rakmitra/aero361/design_web/Laplace.pdf This problem is an example of the Dirichlet Problem shown in the reference above. a) Begin by defining the simulation grid for this problem. This can be as large as you want but for this problem, let's define the grid to be 50 x 50. Hint: You will need a simulation grid for the voltage at the current iteration and a voltage at the previous iteration of the problem. To define the grid in MATLAB, make 2 empty matrices by using the zeros function (each voltage grid should be one unit larger than the simulation grid in each dimension) b) Now, apply 10 V to one side of the current voltage matrix. You can do this by changing one row c) Following the reference above, compute the maximum error between the current iteration matrix d) Now, apply the algorithm in equation 14 and recalculate the maximum error. Continue computing e) Plot the voltage matrix by using the imagesc function in MATLAB. Attach a screenshot of the plot. of the matrix to 10. and the previous iteration matrix. equation 14 until the maximum error is below 0.01. f) Plot the electric field distribution by first computing the gradient of the voltage matrix, then by using the quiver function to plot the vector function. Attach a screenshot of the plot. g) Repeat steps b)-f) but this time, change the constant 10 V applied to one side to a voltage distribution represented by 10* rowNumber* (1-rowNumber). This can be applied in MATLAB with the following code: rowNum-1:1: xDim+1; V_now (rowNum, yDim+1)-10((rowNum-1) /xDim) . * (1-(rowNum-1)/xDim))Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started