Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

code using Mathlab Task 1 Write your own function mfile that accepts two row vectors, A and B, as inputs and produces the following outputs.

code using Mathlabimage text in transcribed

Task 1 Write your own function mfile that accepts two row vectors, A and B, as inputs and produces the following outputs. Save your function mfile as task1.m A scalar that gives the number of elements in B that are greater than the mean of the elements in A. A column vector of all the prime numbers that lie between the minimum value in A and the maximum value in B. A two element row vector in which the first element is the number of prime numbers between min(A) and max(B) that are also greater than the mean of the elements in A. The second element in this vector is the sum of these primes. Next write a script mfile to test your function for the following cases. Save your script file as "ScriptTask1.m". Be sure to assign all three outputs to target variables with unique descriptive names in each of the function calls. This practice is to ensure that all of your results are stored in the base workspace. Make sure to include help comments in your script mfile as well. Test case 1: A = [12 9 3 2 25]; B = [16 20 45 15 12]; Answers for case 1 should be... %There are 3 elements in B greater than the average of A which is out1 = 3 10.2. out2 = [2 357 11 13 17 19]' %These are the primes between min(A) = 2 and max(B) = 20. out3 = [4 60] %Four of the primes in are greater than mean(A) and their sum is 60. Test case 2: A = [3:3:99]; B = [4:4:44]; Test case 3: A = [100:-2:50]; B = [60:70]; Test case 4: make up your own

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Climate And Environmental Database Systems

Authors: Michael Lautenschlager ,Manfred Reinke

1st Edition

1461368332, 978-1461368335

More Books

Students also viewed these Databases questions