Create a matlab function named sumprod

Assignment Help MATLAB Programming
Reference no: EM132088497

Part 1:

Create a MATLAB function named sumprod that meets the following specifications:

• It accepts three input arguments and returns two output arguments.

• The first output argument is the sum of the three inputs. The second output is the product of the three inputs.

• The function itself should be silent, i.e., it should not prompt the user for input nor should it print anything.

Part 2:

Write a MATLAB script named testps that performs the following tasks:

• Prompts the user to enter the number of times N to repeat a loop.

• Calls your sumprod function within a for loop with the following properties:

o The loop executes for N iterations, starting at 1 with an increment of 1.

o If the looping variable's value is even, sumprod is called with these arguments:

1) Input argument 1 = looping variable

2) Input argument 2 = looping variable * 3

3) Input argument 3 = looping variable ^ 2

o If the looping variable's value is a multiple of three, sumprod is called with these arguments:

1) Input argument 1 = looping variable + 5

2) Input argument 2 = looping variable / 2

3) Input argument 3 = looping variable o If the loop variable's value is neither of the above cases, then the input arguments are all zero.

o Display the output at each iteration using the fprintf function

Reference no: EM132088497

Questions Cloud

Why do injuries to the spinal cord can result in paralysis : Why do injuries to the spinal cord can result in paralysis, but typically, injuries higher on the spinal cord would result in a more serious injury?
Determine the infeasibility of some paths including cyclic : Use detection of subsumptions and the abstract-check-refine paradigm to determine the infeasibility of some paths including cyclic paths.
Job design and quality of work practices : BUHRM5912 Human Resource Management - FEDERATION UNIVERSITY AUSTRALIA - Examine how the recent/proposed changes in your chosen environmental factor
Production of an action potential : What would occur if voltage-regulated Na+ and K+ gates opened at the same time, rather than at different times, during the production of an action potential?
Create a matlab function named sumprod : Create a MATLAB function named sumprod . Prompts the user to enter the number of times N to repeat a loop.
Producing the female sex hormone : The layer of granulosa cells surrounding the oocyte within the ovary are responsible for producing the female sex hormone also known as?
Why does a lack of atp cause muscles : 1. Why does a lack of ATP cause muscles to stay relaxed or contracted?
Write a function called ispalindrome which uses a stack : Write a function called isPalindrome which uses a stack of characters to implement the above algorithm.
Prepare the journal entries in the records of white foam ltd : White Foam Ltd had received applications for 501,100 shares and 44,000 options by 10 May. Prepare the journal entries in the records of White Foam Ltd

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