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

  How do you print a sorted list of all environment variables

Write a program that reads a file specified as argument. How do you print a sorted list of all environment variables in the form variable=value?

  Write a java program that read strings until done is entered

Write a java program that reads strings until "done" is entered that will count the number of times a specified character is contained in the string.

  Write a program that hints the user to input a different num

Write a program that hints the user to input a different number each time repetitively (both integer and float numbers are acceptable).

  Write a report on how to used them

For several of the commands, you require to practice them on some files.

  Write a function named squareall that has 2 args

Write a function named squareAll that has 2 args: the first arg is an array of doubles and the second arg is an unsigned that is the number of elements .

  Describe the characteristics of cloud-based storage

Describe the characteristics of cloud-based storage. Describe the characteristics and availability OS (such as Windows, MacOS, or Linux) and specific hardware.

  Write a cgi program to numerically solve a cubic equation

Write a CGI program to numerically solve a cubic equation using the Newton-Raphson method.

  Create a while loop that will start deducting each purchase

In this problem you are going to keep buying items until you reach your maximum credit limit. You will ask the user for their credit limit first.

  Write a function in matlab that takes as input the number n

Write a function in Matlab that takes as input the number n, a sparse matrix given as r, c, v, m, an n-component column vector b, and a tolerance tol.

  Write a java program that declares a radius value

Write a java program that declares a radius value as an integer of your choice and then calculates and prints the area.

  What must the first markup output of servlet to a client be

What must the first markup output of a servlet to a client be? What class of object is used to create markup output of a servlet to a client?

  What is meant by competitive analysis

In what specific ways does a firm undertake this analysis and what tools can they use? In general, what is meant by Competitive Analysis?

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