Question

Implement the following matlab function to classify points.[(b) 3 points, classifypoints.m) Implement the Matlab function function category - classifypoints(file, points) %Reads parame

0 0
Add a comment Improve this question Transcribed image text
Answer #1
function category = classifyPoints(file, points)

    x = points(1,:); %This will return the first row which represent x coordinates.
    y = points(2,:); %This will return the second row which represent y coordinates.
    
    category = x >= y; %This will return a vector which value will be 1 if x>=y and 0 otherwise.

end

To give an example, let's say that the "points" matrix looks as follows

5 1 2 7 2 3 5 4

Above function will have following values:

x=512

y = \begin{bmatrix} 2& 3 & 5 & 4 \end{bmatrix}

points - 1 0 0 1

Add a comment
Know the answer?
Add Answer to:
[(b) 3 points, classifypoints.m) Implement the Matlab function function category - classifypoints...
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
  • Using MATLAB Please Write a MATLAB function that takes coord natos of four points as inputs and returns the coord nates of ntersection of the line passing through ooints 1 and 2 and the line passing t...

    Using MATLAB Please Write a MATLAB function that takes coord natos of four points as inputs and returns the coord nates of ntersection of the line passing through ooints 1 and 2 and the line passing through points 3 and 4. For function name and inout arguments, use: P line_int(P1, P2, P3, P4) The function should be able to handle row or column vector entries. This function will use a sub-function called line_eq. This sub-function takes coordinates of two points...

  • please solve in matlab 1[35p) Write a user-defined MATLAB function that determines the unit vector in...

    please solve in matlab 1[35p) Write a user-defined MATLAB function that determines the unit vector in the direction of the line that connects two points (A and B) in space. For the func- tion name and arguments, use n = unitvec (A,B). The input to the function are two vectors A and B, each with the Cartesian coordinates of the corre- sponding point. The output is a vector with the components of the unit vector Join the direction from A...

  • B.1 Write a MATLAB user-defined function for interpolation with linear splines Name the function Yint =...

    B.1 Write a MATLAB user-defined function for interpolation with linear splines Name the function Yint = Linear Splines, y, rint), where the input ar- guments and y are vectors with the coordinates of the data points and rint is the coordinate of the interpolated point. The output argument Yint is the y value of the interpolated point. Also write a program in a script file that plots the data points and the curve of the Linear splines that interpolates the...

  • 1. Write a MATLAB function that takes a matrix, a row number and a scalar as...

    1. Write a MATLAB function that takes a matrix, a row number and a scalar as arguments and multiplies each element of the row of the matrix by the scalar returning the updated matrix. 2. Write a MATLAB function that takes a matrix, two row numbers and a scalar as arguments and returns a matrix with a linear combination of the rows. For example, if the rows passed to the function were i and j and the scalar was m,...

  • Problem 6 Implement a MATLAB function bisection.m of the form bisection(a, b, f, p, t) function...

    Problem 6 Implement a MATLAB function bisection.m of the form bisection(a, b, f, p, t) function [r, h] % a Beginning of interval [a, bl % b: End of interval [a, b] % f: function handle y f(x, p) % p: parameters to pass through to f % t: User-provided tolerance for interval width At each step j 1 to n, carefully choose m as in bisection with the geometric (watch out for zeroes!) Replace [a, b] by the smallest...

  • Matlab code for this problem. 1[35pl Write a user-defined MATLAB function that determines the unit vector...

    Matlab code for this problem. 1[35pl Write a user-defined MATLAB function that determines the unit vector in the direction of the line that connects two points (A and B) in space. For the func- tion name and arguments, use n = unitvec (A,B). The input to the function are two vectors A and B, each with the Cartesian coordinates of the corre- sponding point. The output is a vector with the components of the unit vector in the direction from...

  • (a) (4 points) Fill in the blanks in the following MATLAB function M file trap so...

    (a) (4 points) Fill in the blanks in the following MATLAB function M file trap so that it implements the composilu trapezidul rulo, using a soquence of w -1,2, 4, 8, 16,... trapezoids, to approximatel d . This M file uses the MATLAB built-in function trapz. If 401) and y=() f(!)..... fr. 1)). 3= ($1, then the execution of z = trapz(x, y) approximates using the composite trapezoidal rule (with trapezoids). (Note that the entries of are labeled starting at...

  • in matlab please 1. (44 points): Given the equations u, v, and w: create a function...

    in matlab please 1. (44 points): Given the equations u, v, and w: create a function file that has u, v, and was outputs and for inputs b and t. Given that t is osts with At = and bis 10 < b < 30 with Ab = 1. Plot the results of u vs. v vs. w all on the same 3D plot. (Hint: Use a for loop to call the function file and have the outputs of the...

  • For this project, each part will be in its oun matlab script. You will be uploading a total 3 m f...

    For this project, each part will be in its oun matlab script. You will be uploading a total 3 m files. Be sure to make your variable names descriptive, and add comments regularly to describe what your code is doing and hou your code aligns with the assignment 1 Iterative Methods: Conjugate Gradient In most software applications, row reduction is rarely used to solve a linear system Ar-b instead, an iterative algorithm like the one presented below is used. 1.1...

  • Implement the following function in the PyDev module functions.py and test it from a PyDev module...

    Implement the following function in the PyDev module functions.py and test it from a PyDev module named t04.py: def print_matrix_char (matrix): وق في ال Prints the contents of a 2D list of strings in a formatted table. Prints row and column headings. Use: print_matrix_char (matrix) Parameters: matrix Returns None. a 2D list of strings (2D list) w Sample testing: Number of rows: 3 Number of columns: 4 0 1 2 3 i 0 C u r 1 Z 2 Y...

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