Question: I need help converting the math lab code to for/end loop following the direction given. 1. Add a for and end statement to define the
I need help converting the math lab code to for/end loop following the direction given.


1. Add a for and end statement to define the loop. ONLY include the parts that need to be done repetitively Since you will not be accessing ALL of the values in the vectors (Tc, pc, and Vm0 simultancously with dots, you will need to 'call' each element in the vectors one at a time. In the equations for a, b, & p, replace the Vectors with a call for the "n'h" element in the vector. For example in dot-notation, you just used a "Tc" in the a equation. Now it will be "Tc (n)" in the for-end loop method. Do this for all of the vetctors. Next remove the dots that were in the dot-notation method code. You do NOT use dots in the for-end equation since you are no longer multiplying (or dividing) whole vectors, you are now only multiplying (or dividing) one element at a time. Since you will be calculating a "p" value for the "nth"elements, so call it "p(n)" like you do with each vector element. Make sure the p equation puts the result in "p(n)" Finally, the ONLY result that is to be shown is the FINAL value for "p", so add a print statement AFTER the for-end loop. HINT: DO NOT use "disp(p)" command, I will mark it as WRONG. Then answer the following questions: 2. 3. 4. 5. cleariclc R 8.314 T600 Tc= [549.8 563.5 553.5 550.0 562.0 568.81; Pc[2.53 2.63 2.562.492.65 2.69]; Vm[2100 1900 1800 2210 1875 1980 % NOTE: the dots in the equation assignments for a, b, & p below. % the answe r wil be a vector answer instead of a scalar
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
