The information is shown below for the 20 daysto make the Si
The information is shown below for the 20 daysto make the Simple Moving Average Filters. Use the first 5 days for the short-term filter and all the days for the long-term filter. Be careful not to make any careless mistakes as it is very easy to go wrong in taking down the values.
Date - Closing Price
01/07/14 - 32.8400
02/07/14 - 33.3900
03/07/14 - 33.6400
04/07/14 - 33.7800
07/07/14 - 33.8700
08/07/14 - 33.5900
09/07/14 - 33.1800
10/07/14 - 33.1600
11/07/14 - 33.3500
14/07/14 - 33.5400
15/07/14 - 33.2300
16/07/14 - 33.1500
17/07/14 - 33.2100
18/07/14 - 33.4200
21/07/14 - 33.3900
22/07/14 - 33.3700
23/07/14 - 33.5000
24/07/14 - 33.5800
25/07/14 - 33.7500
28/07/14 - 33.5200
In MATLAB create a short-term SMA filter (-5 days) and a longer-term SMA filter 20 days) and apply these to the closing prices of your stocks (use MATLAB filter function to do this). Plot the outputs in MATLABSolution
MATLAB code is
function [P] = filter123(A)
[x]=textread(\'filterdata.txt\',\'%s\');
j=1;
k=1;
for i=1:A
p(j)=x(k,1);
q(j)=x(k+2,1);
k=k+3;
j=j+1;
end
plot(p,q)
end

