Menu

[Solved]1 Write Matlab User Defined Function Converts Integers Decimal Form Binary Form Name Funct Q37223177

both in matlab language
1. Write a MATLAB user-defined function that converts integers from decimal form to binary form. Name the function [b]-LASTNA1. Write a MATLAB user-defined function that converts integers from decimal form to binary form. Name the function [b]-LASTNAMES_int2bin (d), where input argument d is the integer to be converted and the output argument b is a vector with 1’s and O’s that represents the number d in binary form. The Jargest number that can be converted with your function should be a binary number with 16 1’s. If a larger number is calculated, your function display’s an error message. HINT: Use the “Divide by 2” method. Check for correct number and valid inputs and display proper error/warning messages. Your program must include a header, H1/help information and proper line comments. Submit your function to BeachBoard. (8 Points) The area of a triangle ABC can be calculated by 2. Area-lABX ACll. where II is the magnitude of the vector, AB is the distance vector from point A to point B and Ac is the distance vector from point A to point C. Write a MATLAB user-defined function [area]-LASTNAMES. TriArea (A, B,C) , to calculate the area of the triangle using the equation above. The input A, B, and C are ID arrays containing the XY。r XYZ coordinates of the vertices of the triangle, eg In your function, create two local functions, [vec]-VecDist (vertexl,vertex2) and [crossprod]-VecCross (vec1, vec2). The VecDist () local function returns the distance vector between two points given by vertexl and vertex2. The Veccross local function computes the cross product of two vectors given by vecl and vec2. DO NOT use MATLAB built-in functions to calculate the cross product. Check for correct number and valid inputs and display proper error/warming messages, Your code must include a header, Hi/help information and defined function with local functions to BeachBoard. (10 Points) proper line comments. Submit your user- Using your function above, write down the function call that you use and the answer for the area calculation of a triangle formed by 3 points: (0,0,0), (6.5, 0, 0) and (5.5, -4, 0). (2 Points) Show transcribed image text 1. Write a MATLAB user-defined function that converts integers from decimal form to binary form. Name the function [b]-LASTNAMES_int2bin (d), where input argument d is the integer to be converted and the output argument b is a vector with 1’s and O’s that represents the number d in binary form. The Jargest number that can be converted with your function should be a binary number with 16 1’s. If a larger number is calculated, your function display’s an error message. HINT: Use the “Divide by 2” method. Check for correct number and valid inputs and display proper error/warning messages. Your program must include a header, H1/help information and proper line comments. Submit your function to BeachBoard. (8 Points) The area of a triangle ABC can be calculated by 2. Area-lABX ACll. where II is the magnitude of the vector, AB is the distance vector from point A to point B and Ac is the distance vector from point A to point C. Write a MATLAB user-defined function [area]-LASTNAMES. TriArea (A, B,C) , to calculate the area of the triangle using the equation above. The input A, B, and C are ID arrays containing the XY。r XYZ coordinates of the vertices of the triangle, eg In your function, create two local functions, [vec]-VecDist (vertexl,vertex2) and [crossprod]-VecCross (vec1, vec2). The VecDist () local function returns the distance vector between two points given by vertexl and vertex2. The Veccross local function computes the cross product of two vectors given by vecl and vec2. DO NOT use MATLAB built-in functions to calculate the cross product. Check for correct number and valid inputs and display proper error/warming messages, Your code must include a header, Hi/help information and defined function with local functions to BeachBoard. (10 Points) proper line comments. Submit your user- Using your function above, write down the function call that you use and the answer for the area calculation of a triangle formed by 3 points: (0,0,0), (6.5, 0, 0) and (5.5, -4, 0). (2 Points)

Expert Answer


Answer to 1. Write a MATLAB user-defined function that converts integers from decimal form to binary form. Name the function [b]-L… . . .

OR


Leave a Reply

Your email address will not be published. Required fields are marked *