Question: modify the Matlab script to provide two new versions. % Ask for the start and end values start = input('Please enter the start value'); finish

modify the Matlab script to provide two new versions.

% Ask for the start and end values start = input('Please enter the start value'); finish = input('Please enter the finish value'); No_intervals = input('How many intervals?'); % Note: There is additional checking to do here - what is it? % Calculate the interval size interval_size = (finish-start) / No_intervals; % Intergral value will be stored in result; result = 0; % Loop over the range - the function we summing is x^2 for x = start:interval_size:(finish-interval_size) result = result + 0.5 * ( Function_to_Integrate(x) + Function_to_Integrate(x+interval_size) ) * interval_size; end % Display the answer fprintf("The integral of x^2 between x=%d and x=%d is %f ",start,finish,result); % ---------------------------------------- % This is the funtion you will be integrating (y=x^2) function y = Function_to_Integrate(x) y = x*x; end

1) A version that uses parfor

2) convert this code into a version that uses four parallel workers (spmd)

Help!

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!