Question

Algorithm 6 First draw a flow chart then create a function with the header [X] - lowest (A) that will find the lowest value of the array A and output the value in X. This function should work for an array A of any length Hint: the length() function may be of use Rules you cannot use the MATLAB sort() function and you cannot use the max(), min( ), maxk or mink functions Check your function [X] -lowest([19, 24, 2, 3, 4, 5, 6, 7, 8, 9.1. 2,3, 321)

MATLAB

0 0
Add a comment Improve this question Transcribed image text
Answer #1

%save this file as findMinimum.m

%then call this function command line or something as you want

function [B]=findMinimum(A)
n=length(A); % it is used to find length of input vector
B=A(1); % assume the first one is minimum
for i=1:n
if(B>A(i)) % if current is lesser one then take it
B=A(i); % finally minimum value will be stored in B
end
end
end

% here is the flow chart

Flow chart Start A is one dinentono. Fae Tra e Tru e s to p

Add a comment
Know the answer?
Add Answer to:
MATLAB Algorithm 6 First draw a flow chart then create a function with the header [X]...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • write a Matlab program ( solve the three questions). please use array and create your own...

    write a Matlab program ( solve the three questions). please use array and create your own function to check primality Question 1 : [10 points) Write a MATLAB program that will store all the first 1000 prime numbers in an array variable named arr_of_primes. Please note that a prime number is a positive integer that is bigger than or equal to 2 which is divisible only by 1 and itself. Examples of the first 8 primes are: 2, 3, 5,...

  • 1) Create a matlab function that calculates: for Name your function TwoVarFunc : The inputs should...

    1) Create a matlab function that calculates: for Name your function TwoVarFunc : The inputs should be in the same order: xmin xmax ymin ymax N: n is the number of elements in the vector x and y The ouputs should be in the same order: f_xy: is the calculated array f(x,y) f_xyMAX: should be the the maximum value of the function f(x,y). Hint: to create vectors x and y look up the matlab built-in function linspace() Hint 2: To...

  • matlab 1. Write a MATLAB user-defined function that finds the largest element(s) of a matrix. Name...

    matlab 1. Write a MATLAB user-defined function that finds the largest element(s) of a matrix. Name the function [max_value, max_index] - LASTNAMES matrix max (x), where input argument x is a vector or matrix (not a scalar), and the outputs are the maximum value(s) and indexes of the maximum value(s) of the mput x. Do not use MATLAB functions max() or find(). Use loops and if branches to determine the maximum elements of matrix. Check for correct number and valid...

  • Just Q3 and Q4 Q1] Write a C function to implement the binary search algorithm over...

    Just Q3 and Q4 Q1] Write a C function to implement the binary search algorithm over an array of integer numbers and size n. The function should return the index of the search key if the search key exists and return - 1 if the search key doesn't exist. [10 Points] Q2] Write a C function to implement the selection sort algorithm, to sort an array of float values and size n. The function should sort the array in ascending...

  • please write the matlab function that corresponds with this algorithm Create maze algorithm 1) Function create...

    please write the matlab function that corresponds with this algorithm Create maze algorithm 1) Function create maze( maze size: whole number, monsters: whole number) returns maze: [1..N][1.N] of trings 2) maze-maze-size][maze-size] array of strings, filled with "O" 3) mazerandom # between 1 and maze size [random # between 1 and maze-size-"P" 4) tempx random whole number between 1 and maze size 5) tempy random whole number between 1 and maze_size 6) while mazeltempx] [tempy]="P" a. tempx random whole number between...

  • psuedocode and raptor flow chart- i need the basic psuedocode and raptor flow chart with reverse...

    psuedocode and raptor flow chart- i need the basic psuedocode and raptor flow chart with reverse loop logic. For this program, you will calculate a student's average for a semester. The student has earned 6 test grades during the semester, and their average is calculated after removing the lowest grade from the scores. Write a program that asks the user to enter the six grades and stores them in an array. Then, search the array for the lowest value and...

  • matlab help Write a script to manipulate the array A = [2 1 4 3 6...

    matlab help Write a script to manipulate the array A = [2 1 4 3 6 5 8 7 10 9 12 11 14 13 16 15 18 17 20 19] to be in descending order without using the sort function. You must do everything using array manipulation in MATLAB (i.e. you cannot sort it by hand and then hardcode it, you cannot simply create the array 1:20, you cannot simply add .rej3mat(J-l 1],1,10) to A). Write a script that...

  • MATLAB Problem HW7P2 (20 points) (5 pts) Write a user-defined MATLAB function called HW7P2_fn for the...

    MATLAB Problem HW7P2 (20 points) (5 pts) Write a user-defined MATLAB function called HW7P2_fn for the following math function 3 o-0.47x The input to the function is x and the output is y. Write the function such that x can be an array (use element-by-element operations) (15 pts) Use the function in (a) the command window to calculate y(-2) and y(5) (b) a script file HW7P2.m to determine y(x) for 0.001 Sx S 10 with 1000 points. Hint: Use the...

  • Create a MATLAB function to perform Lagrange Interpolation. Your function will be used as illustrated below:...

    Create a MATLAB function to perform Lagrange Interpolation. Your function will be used as illustrated below: >> ya = Lagrange(x, y, a) where "x" is a vector of ? independent data values, "y" is a vector of ? dependent function values corresponding to "x", "a" is an arbitrary value of "x" for which you want to know the Westimate of "y", and "ya" is the estimate of the function at x=a. Print an error message and exit the function if...

  • MATLAB Any guidance is appreciated! Use meshgrid() function to create 2D grid coordinates with x- and...

    MATLAB Any guidance is appreciated! Use meshgrid() function to create 2D grid coordinates with x- and y- coordinates both from -12 to +12 in the increment 1/32. B) Calculate the function z shown below at every (x, y) point and store the result in a 2D array z Z = sin(squareroot x^2 + y^2)/ squareroot x^2 + y^2 c) Find the maximum value in array z and its corresponding index. The array may have more than one maximum points with...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT