Write a matlab function which will take a vector of integers

Assignment Help Computer Engineering
Reference no: EM132206047

Question :

Write a Matlab function called onlyoddprod.m which will take a vector of integers invest and return the product of only its odd positive entries as the value outfall.

All negative entries, zero entries, and positive even entries will be ignored. If the vector contains no odd positive entries, then the function should simply return the value 1.

You must use either a for loop or a while loop in you function to calculate the product. You are forbidden from using any other built-in Matlab functions as a part of your function.

Function specifications and some sample function calls are given below. input parameter invest vector of integer values product of only odd positive entries input parameter invest output parameter outfall

sample function calls

onlyoddprod([1, 2, 3, 4, 5, 6, 7]) produces 105

onlyoddprod([-2, 3,0, 9, 4, -5]) produces 27

onlyoddprod([-8, -1,0, 2]) produces 1

onlyoddprod([2, 4, 6, 8, 10]) produces 1

Reference no: EM132206047

Questions Cloud

Write a matlab script to numerically solve any first order : Write a MATLAB script file to numerically solve any first order initial value problem using Rulers method.
Accept a two-dimensional array of integers as a parameter : Write a method called is Magic Square that accepts a two-dimensional array of integers as a parameter and returns true if it is a magic square.
Disadvantages of adding indexes to a database tables : What are the advantages and disadvantages of adding indexes to a database tables?
Which specific professions would you choose : Given what you have found out regarding the psychological perspectives on aging pertaining to the changes impacting memory, clarity, wisdom, creativity, recall.
Write a matlab function which will take a vector of integers : Write a Matlab function called onlyoddprod.m which will take a vector of integers invest and return the product of only its odd positive entries as the value.
Describe the policies and their impact on the field agency : Describe the policies and their impact on the field agency. Propose specific recommendations regarding how you, as a social work intern, and the agency.
Determine the long-run steady-state distribution : The first number in each state is the number of customers in the system and the second is the phase of service for the customer in service.
Describe the client assets and resources : Describe the client's assets and resources (in order to understand the client's resilience). Describe how you, the social worker, will intervene to assist.
Describe the presenting problem in one concise sentence : Social workers strive to make informed decisions about the interventions they implement. These decisions should be driven by what the research data say.

Reviews

Write a Review

Computer Engineering Questions & Answers

  Develop detailed object-oriented design models

You have the following two choices to develop detailed object-oriented design models. You also need to submit a proper documentation

  Create an application that lets the user enter an items cost

Retail Price Calculator Create an application that lets the user enter an item's wholesale cost and its markup percentage.

  What are the advantages to having a larger smartphone

Conduct a web search to learn more about the larger smartphones and tablet options. What are the advantages to having a larger smartphone?

  Produce the context diagram for system

Produce the context diagram for system.

  Display an image of a robot near the left side of a web page

Display an image of a robot near the left side of a web page. The image can be any graphics file you find on the web or create yourself.

  Discuss the business impact analysis process

What different loss criteria types can be associated with threats identified during the Business Impact Analysis process

  What do you understand by structural parallelism

What do you understand by structural parallelism in a parallel program? List the different possible forms of structural parallelism which we have studied.

  Write the codes for paradise and airspeed

Draw the optimal coding tree and the (weighted) average code length. Show the steps. Write the codes for "paradise" and "airspeed".

  Design an error-logging system for an error-detecting memory

Whenever an error is detected, a low-priority interrupt is generated by the error detection circuit, and the operating system then makes a note of the location.

  Create m-file to calculate the future value

Write down M-file to calculate the future value of an initial investment, or the amount that needs to be deposited annually to reach future investment goal.

  How would you denormalize the physical data model

DENORMALIZING A STUDENT ACTIVITY FILE. How would you denormalize the physical data model, and what are the benefits of your changes?

  Write the portions of the render function needed

Write the portions of the render function needed to draw the picture below (snowman) using just these points.

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