question on matlab. this is for a function.
the question is "write a function called tri_area that returns the area of a triangle with base b and height h, where b and h are input arguments of the function in that order "
% tri_area.m
function area = tri_area(b, h)
area = 0.5*b*h;
end


question on matlab. this is for a function. the question is "write a function called tri_area...
MATLAB QUESTION Write a MATLAB function called vector_input that takes no inputs and returns no outputs. Instead, when called, it gives control to the user and asks the user to input a length-3 vector. Then the function prints: The sum of ___, ____, and ____ is ____. [new line] where the first three blanks are filled by each element in input vector, and the last blank is the sum of all three elements.
Question 4 Write a program that display the area of a triangle. The program calls the following two functions: .getBaseHeight - This function uses a reference parameter variables to accept a double arguments base and height. This function should ask the user to enter the triangle's buse and height. Input validation: base and height should be positive numbers. calArea - This function should accept the triangle's base and height as arguments and return the triangle's area. The area is calculated...
Write a user-defined MATLAB function that will calculate the area/volume of a shape whose dimensions are given by the user. This function will be able to calculate the area for 2D objects like a triangle or a rectangle and 3D objects such as a box. The name of the function will be findArea and it will have four input arguments. The first input argument will be the length. The second input argument will be the width. The third input argument...
Visual Studio - Printf and Scanf Create a function called area that calculates the area of a triangle. The function requires 2 parameters/arguments. The variables passed to the function are called base and height. To calculate the area multiply height times the base. In addition to the function add your code to both prompt for the values of area and height and base and then call the area function to display/print the area.
use matlab and show all codes and work
the question continues from this
4. Write a function with header (A, V - myCone (r, h), which outputs the total area A and volume of a cone with base radius r and height h. 5. Write a function - myMatrix (myvec, m, n) which creates an m-by-n matrix A, as in Problem 3, but for arbitrary values of mand n and any length of vector myvec. Hint: the function can use...
** Please provide a code in MATLAB ** 1. Write a function called taxcalculator that reads an amount in dollars, adds tax based on the table below and return the total with tax using elseif statement. 2. Write a function called printstars that reads the number of rows and returns a triangle of stars similar to the one below: * ** *** **** ***** ****** ******* ********
MatLab question, please answer in matlab. %{ Write a function that prints the area and circumference of a circle for a given radius. Only the radius is passed to the function. The function does not return any values. The area is given by pi*r^2 and the circumference is 2*pi*r. The function is called areaCircum. Example: areaCircum(input value) %} % Place your function call here
Matlab Question (Matlab Grader) Where indicated at the bottom of the script. write a function, called isright, that takes three inputs, a, b, and c, and determines whether they are could be the lengths of the sides of a right triangle; the output, y, will be set equal to the following: i). -1 if at least one of the values is not positive. Also, only for this case, have the function print out an error message, which states "At least...
What would the function look like in MATLAB? Write a function called mysort that takes a 3-element vector as its sole arguments. It uses if statements, possibly nested, to return a 3-element vector with its elements in non-decreasing order, i.e., the first element in the returned vector equals the smallest element of the input vector and the last element equals the largest element in the input vector. NOTE: Your function should not use any built-in functions, e.g., sort, min, max,...
PLEASE USE MATLAB AND LOOP STATEMENTS TO SOLVE THE FOLLOWING PROBLEM: Write a function called palindrome that receives a whole number as input and returns true if the number is palindromic, and returns false otherwise. Recall that number is palindromic if it remains the same when the order of its digits is reversed. Examples of palindromic numbers are: 7, 44, 191, 3883, 25052, 617716.