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

  Mathematics in computing

Binary search tree, and postorder and preorder traversal Determine the shortest path in Graph

  Ict governance

ICT is defined as the term of Information and communication technologies, it is diverse set of technical tools and resources used by the government agencies to communicate and produce, circulate, store, and manage all information.

  Implementation of memory management

Assignment covers the following eight topics and explore the implementation of memory management, processes and threads.

  Realize business and organizational data storage

Realize business and organizational data storage and fast access times are much more important than they have ever been. Compare and contrast magnetic tapes, magnetic disks, optical discs

  What is the protocol overhead

What are the advantages of using a compiled language over an interpreted one? Under what circumstances would you select to use an interpreted language?

  Implementation of memory management

Paper describes about memory management. How memory is used in executing programs and its critical support for applications.

  Define open and closed loop control systems

Define open and closed loop cotrol systems.Explain difference between time varying and time invariant control system wth suitable example.

  Prepare a proposal to deploy windows server

Prepare a proposal to deploy Windows Server onto an existing network based on the provided scenario.

  Security policy document project

Analyze security requirements and develop a security policy

  Write a procedure that produces independent stack objects

Write a procedure (make-stack) that produces independent stack objects, using a message-passing style, e.g.

  Define a suitable functional unit

Define a suitable functional unit for a comparative study between two different types of paint.

  Calculate yield to maturity and bond prices

Calculate yield to maturity (YTM) and bond prices

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