Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Without Conditionals or Iterations MATLAB - We are interested in evaluating if two stocks in the market are moving together with respect to increases and
Without Conditionals or Iterations MATLAB
- We are interested in evaluating if two stocks in the market are moving together with respect to increases and decreases in value based on their contour. We define the contour of a sequence of values to be whether consecutive elements of the vector are increasing or decreasing. Therefore, any vector defines a sequence of up and down contours based on the difference between adjacent values. The contour of two vectors is the same if they both have the same pattern of increasing and decreasing elements. For the contour to be the same, the vectors DO NOT have to have the same values, nor does the amount by which elements increase or decrease have to be the same; only the pattern of increasing and decreasing matters. For example, v1 =[2,4,3] and v2 =[3,10,8] have the same contour because both follow the pattern [ increasing, decreasing]. Conversely, v 3=[5,3,1] and v4 =[1,4,1] do not have the same contour, since v3 follows a [decreasing, decreasing] pattern while the second one follows the pattern [increasing, decreasing]. The function should output true if and only if the two vectors have the same "contour". Both vectors will always be the same length. A single number has the same contour as any other single number. Make sure that your output is class logical and not double. You will get the problem wrong if you output a double 0 instead of a logical falseStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started