Write function that will receive three positive integers

Assignment Help MATLAB Programming
Reference no: EM131871446

MATLAB Question: Write a function check_even that takes any number as input and outputs logical 1 if it's an even number and 0 otherwise.

Your answer must contain only the function definition (that is, nothing should come before function or after end. The automatic grading will then try a number of different inputs to your function, to test whether it works correctly. Don't forget to write some help text for your function!

A Pythagorean triple is a set of positive integers (a, b, c) such that a^2 + b ^2 = c^2. Write a function is_pythag_triple that will receive three positive integers (a, b, c, in that order) and will return logical 1 (for true ) if they form a Pythagorean triple, or 0 (for false ) if not.

Your answer must contain only the function definition (that is, nothing should come before function or after end. The automatic grading will then try a number of different inputs to your function, to test whether it works correctly. Don't forget to write some help text for your function!

Write a function gen_fibo that will output a vector with the first n numbers of the Fibonacci sequence.

Hint: Use the pseudocode below as a starting point!

Your answer must contain only the function definition (that is, nothing should come before function or after end. The automatic grading will then try a number of different inputs to your function, to test whether it works correctly. Don't forget to write some help text for your function!

Untitled

function fibo_vec = gen_fibo(n)

n = input_arg % get the length of the sequence

% initialize start of sequence

number1 = 1

number2 = 1

% If we want one number

'assign number1 to first element of output vector'

% If we want two numbers

'assign number1 to first element of output vector'

'assign number2 to 2nd element of output vector'

% Take care of the other numbers:

'IF there is still one or more numbers to print'

'Repeat FOR each number that is left'

% compute+print new number

new_num = number1 + number2

'assign new number to next element in output vector'

% update the two numbers

number1 = number2;

number2 = new_num;

end

Reference no: EM131871446

Questions Cloud

What is the expected return for investment : Investment A is expected to produce annual cash flows forever. What is the expected return for investment A?
Compute the anticipated value of dividends for next years : Compute the anticipated value of the dividends for the next four years. Compute the price of the stock at the end of the fourth year (P4).
Briefly define what is the strategic management : Explain the importance of strategic management in today's rapidly changing health care environment. Provide some specific examples from your own health care.
Square foot basis with equivalent tenant improvements : the existing space in a separate building on a square foot basis with equivalent tenant improvements and number of parking space.
Write function that will receive three positive integers : Write a function is_pythag_triple that will receive three positive integers (a, b, c, in that order) and will return logical 1 (for true) or 0 (for false)
Examine the various roles in a health care environment : Explain the findings of Lewin's behavioral studies regarding leadership styles and behaviors within the various roles in a health care environment.
Illustrating the importance of cash flow in a business : Explain the importance of Cash Flow in a business - why is critical to keep track of balances in Cash Flow b. From your understanding of Industry Sales Force.
The two bonds have the same yield-to-maturity : Bond A pays annual coupons, pays its next coupon in 1 year, The two bonds have the same yield-to-maturity.
Discuss accomplishment of a project objective : Explain the four factors that constrain the accomplishment of a project objective and what steps can be taken to mitigate the constraint.

Reviews

Write a Review

MATLAB Programming Questions & Answers

  Finite difference method

Use the finite difference method to calculate the temperature at the point specified since it is easier.

  Determine the necessary shell temperature

In a shell-and-tube heat exchanger, one fluid passes through a central tube while another fluid flows through an outer shell in the opposite direction. The purpose is to heat the fluid passing through the central tube.

  Find the integral of a function at an arbitrary location

Write a Matlab function to perform numerical integration of a set of evenly spaced data points using the trapezoidal rule

  Compute the speed of single-stage planetary gear train

Write a MATLAB function [speed] = planetary (N, emesh, first, last, arm) that computes the speed of a given link in a single-stage planetary gear train.

  Calculate and plot the error in the numerical derivative

Write a program to calculate and plot the error in the numerical estimate of the derivative.

  Create the graph using matlab functions

Create the graph, which contains a piecewise function where a line exists in the first interval, a parabola in the second interval, and the sine function in the third interval.

  Develop a simulation program

Develop a simulation program

  Create a vector in matlab

Create a three dimensional diagram of function.

  Open a named pipe and to read data from the pipe

Open a named pipe and to read data from the pipe in matlab

  Write the commands that will create the matrix

Write the commands that will create the matrix.

  Lagrange interpolating polynomial of degree

Lagrange interpolating polynomial of degree

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd