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

  Write matlab program that implements a differential encoder

Write a MATLAB program that implements a differential encoder and a differential decoder for a M = 4-DPSK system.

  Write a matlab function dtmfdecode

The sole assignment is to write a Matlab function dtmfdecode that decodes DTMF tones and produces a transcript of the number that it encodes.

  Parking in garage using matlab

In matlab: parking garage charges a $2.00 minimum fee to park for up to three hours. The garage charges an additional $0.50 per hour for each hour.

  Write a simple program that stores the high temperatures

A meteorological company wants you to write a simple program that stores the high temperatures and low temperates for each of the months of the year. After consulting with trusted programming partners, you come up with a great idea

  Applications of complex mathematical concepts

Investigate practical applications of complex mathematical concepts and gain understanding of how mathematics is used in engineering context.

  Write a matlab script that performs dot product

Let a and b be three-dimensional vectors. Write a MATLAB script that performs: 1. the dot product between the two vectors and 2. the cross product a × b.

  Design of a pid controller for an aircraft pitch system

Design of a PID Controller for an Aircraft Pitch System - Present a state-space equation for the dynamical system - Design a unity closed-loop control system

  Write the matlab code that takes the square root of nine

Write the MATLAB code for adding the integers 6 and 3, and storing the sum in a variable x. Write the MATLAB code that takes the square root of 9.

  Write a matlab program that enables you to specify

Write a Matlab program that enables you to specify and keep only a proportion of the Fourier Transforms of largest magnitude from an image representation.

  Downsampling and upsampling a discrete-time

In this MATLAB exercise, we will explore downsampling and upsampling a discrete-time signal corresponding to a piece of music. To start, type load handel. In your workspace, you should now have a vector y of length 73113. Play this piece of music ..

  Considered to equal when the result of one array subtract

Two arrays are considered to be equal when the result of one array subtracted from the other is an array of zeros. In the script file, create the MATLAB commands to prove the following relationships (use arrays that you makeup yourself)

  Create matlab function to plot the rotation of a wheel

Create Matlab function to plot the rotation of a wheel without sleeping. Plot the trajectory of any point on the wheel.

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