Question: 1 . Complete the learner template to compute the power output from a wind turbine with and wind velocity . ( Note that ) .

1. Complete the learner template to compute the power output from a wind turbine with and wind velocity .(Note that ). Assigns the resulting value (in Watts) to a variable named wind_power.
2. Continue completing the template to use a vector of radius values r_vals =[1,12,24,40,60,80,100,120,200] and calculate the corresponding power output of the turbine [2] with those radii at the same wind velocity as above. Use vector operations in Matlab. See reference [5]. In a figure 1, plot r_vals versus power_output. Label the xaxis 'Radius (m)' and the y-axis 'Power (W)'. Use a fontsize of 20 for your axis labels. Use a red line in your plot with a thickness of 3 units. Indicate every data point with (*). Store the elements of the rendered line in a "graphics handle" called 'graph_properties'. (Hint : see help for plot, xlabel commands [3]). Note that the tests in this automatically graded script are very strict so your spacing and syntax in the labels has to be exactly as written here.
3. If you have to perform the same mathematical operation on arrays of numbers in MATLAB, you have two approaches you can use. (This actually also applies to other numerical packagages like numpy and scipy in Python). You can use 'for loops' or vector operations. In MATLAB, vector operations are faster than 'for loops'. You will now test this observation yourself by implementing the calculation in (2) above using the two methods: 'for loops' [4] and vector operations [5], and then measuring the time it takes for the computer to perform the computation. You will need to use MATLAB function 'tic' and 'toc' [6] to calculate elapsed time. You will need to measure the average execution time over 2000 iterations (use variable M to denote number of iterations) of each method to get a reliable measure of T_f ("for" loop execution time) and T_v ("vector computation" execution time). Use MATLAB help to figure this out as well as [6]. Complete the learner template code to perform the following steps.
Use the vector math you used in (2) above to perform the same calculation 2000 times. Assign the values to power_output_a. This should be the same as power_output you calculated above. Assign the duration to the variable T_v
Use a single "for loop" to calculate the power output in (2). Assign the values to the vector power_output_f . Measure the time it takes to perform this operation 2000 times. Assign that value to the variable T_f
Calculate the ratio T_f/T_v and assign that to the variable ratio.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!