Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please use Matlab Code to solve this problem. Thank you write code that will determine % the maximum possible profit (on a $1000 investment) that

Please use Matlab Code to solve this problem. Thank you

write code that will determine % the maximum possible profit (on a $1000 investment) that could be gained % from a perfectly timed buy and subsequent sell. You will need to do this % for each stock independently and then compare the values to determine % which would have resulted in the biggest gain. Recall that one cannot % sell a stock that one does not own, so the purchase must come before the % sale. % % Note that examining the plots from prior parts may help you, by eye, % guesstimate what solution MATLAB should give you. You cannot use these % hard-coded guesstimates as your answer but they may be very helpful in % checking your code to be sure its working as expected. % % Using good practices for formatting output, not the echo, report back to % the user: % (1) the max possible profit of the perfectly timed buy and sell within % each stock and the associated week of purchase and of sale % corresponding to that max profit % (2) the overall max profit among the results of (1)

image text in transcribed

Here are the vectors created I hope this can be enough info to answer this question

Thank in an advance

sminvestment = [1000 , Taiwan_Semiconductor_Manufacturing + 1000]; shinvestment = [1000 , Royal_Dutch_Shell + 1000]; Alinvestment = [1000 , Alphabet + 1000]; Inminvestment = [1000 , Intel + 1000];

Taiwan Semiconductor Manufacturing= [ 31.959999 32.009998 32.73 34.279999 35.18 30.49 30.120001 28.5 28.459999 32.75 32.630001 33.630001 3.650002 41.209999 45.799999 20.389999 27.99 20.03 32.360001 34.299999 34.080002 33.669998 31.120001 31.450001 32.830002 35.869999 27.309999 28.43 29.950001 33.09 25.41 23.66 24.27 25.92 31.51 33.060001 32.66 33 35.349998 35.580002 31.030001 29.01 28.1 28.76 31.91 29 31.040001 45.880001 43.669998 46.650002 44.490002 43.419998 34.119999]: Alphabet= [ 9.85 9.25 9.12 8.64 8.5 8.98 9.38 9.38 9.05 11.06 10.98 10.56 9.93 10.04 9.74 9.55 9.68 9.48 9.27 9.45 9.13 9.41 8.82 .52 8.05 7.81 8.08 8.67 11.08 11.18 11.28 10.82 11.49 11.36 11.19 11.33 11.51 11.11 12.1 11.88 11.65 11.07 13.23 12 11.65 10.71 10.53 10.61 10.7 10.4 10.73 11.15 10.56 Intel- [ 39.400002 37.529999 37.73 36.59 36.380001 35.950001 36.049999 33.91 34.630001 35.32 33.669998 37.939999 35.169998 36.34 37.68 38.73 37.610001 37.650002 36.709999 36.889999 34.119999 31.790001 31.200001 32.650002 36.029999 35.700001 35.75 35.93 7.950001 34.689999 35.099998 32.98 33.919998 33.330002 34.73 44.07 43.150002 43.490002 41 41.459999 41.09 40.91 37.43 37.84 7-790001 38.299999 43.200001 44.25 43.91 41.25 39.400002 39.16 39.360001] Royal Dutch Shell- 159.389999 159.789993 157.199997 164.520004 166.279999 173.58999 176.610001 173.800003 174.649994 175.729996 163.039993 162.320007 162.929993 164.460007 140.610001 137.419998 144.059998 124.949997 133.199997 137.949997 144.199997 179.369995 181.289993 190 190.279999 176.110001 177.360001 183.289993 176.619995 185.229996 185.089996 186.990005 182.679993 184.919998 193.990005 189.100006 195.950006 201.740005 194.320007 203.229996 207.320007 209.940002 174.989999 177.779999 180.259995 157.330002 153.740005 154.050003 145.369995 150.350006 144.960007 139.529999 131.729996]

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Principles Of Database Systems With Internet And Java Applications

Authors: Greg Riccardi

1st Edition

020161247X, 978-0201612479

More Books

Students also viewed these Databases questions