Question: function script and main script needed for each problem 1. Write a function M-fie called par_res that takes as inpul two resistor values (say R1
1. Write a function M-fie called par_res that takes as inpul two resistor values (say R1 and R2), and outputs the equivalent resistance. say R_eq, if the two resistors are in paraliel. 2. Write a function M-fle called circle_avea that takes as input the radius of the circle, say radius: and yelds as oulput the area of the circle, say area. 3. Write a function M-file caled triangles that takes as input 3 sides (say a, b and c) of a triangle; yields the perimeter, say p, and area, say A (using Heron's formula given below) of the triangle as oulput. Perimeter: p=a+b+c: Heron's formula for Area: A=sqrt(s(sa)(sb)(sc)). where s w p/2, the semi-perimeter Cont. on next page. Problem Set 9 , continued Use the command window to check that your code works for a 3.4.5 right. triangle and a 51213 right briangle. (Use A=1/2 bh in your check for the area.) Note that the check does not have to be part of the function M-flle. 4. From physics, the capachance (in F) between 2 paralel plates, filed with a dielectric material of relative permittivity , can be approvimated by the equation: C=c1,A,d, where A is the area of the plates (in sq. m ), d is the distance (nm ) between the plates, and x0 is the electric constant, 8.8541012 Fim. a. Write a function M-file to find the capactance between two rectangular paraliel plates. with inputs: the length and width of the plates footh in m). the permitivily of the dieloctric material separating the plates, and the distance between the plates (in m ), and with output: the capacitance between the two plates (in F). problem Set 9, continued b. Ater debugging your code, use your program to find: the capacitance between parallel rectangular plates of length 3mm and width 4mm, separaled by distance d=0.2mm, if the relative permitivity of the material between the plates is 2.5. (Be careful with the units.) 5. Legend: When the inventor of the game of chess showed the game to his king. the king offered him whatever prize he desired. The imventor said. I wont be greedy. Just give me one grain of rice for the first square, two grains for the second square, four grains for the third square, etc., doubling the number of grains for each square, up to the last square on the board. Write a MATLAB M-file called chess_board to detemine how many grains of rice the inventor would receive, in tocal. Hint: Note the bye of series. You may want to call one of the function M-files already written
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
