Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

1. The file called \"sunspots.txt\" contains the observed number of sunspots on

ID: 3820028 • Letter: 1

Question

1. The file called "sunspots.txt" contains the observed number of sunspots on the Sun for each month since January 1749. The file contains two columns of numbers, the first being the month, t, and the second being the sunspot number, y(t (a Write a program that reads in the data and makes a graph of sunspots as a function of time (b) One way to demonstrate highly fluctuating data is to calculate moving average (or running average) for the data as you taking the average over small range of data rather than entire data. The moving average of the data, defined by yk +m 2r where r represents the range for taking average and the yk are the sunspot numbers Calculate the moving average for r 5, 10 and 100 and plot both the original data and the moving average on the same graph.

Explanation / Answer

1a)

fileID = fopen('sunspots.txt');
C = textscan(fileID,'%d8 %d8');
fclose(fileID);
months=C{1};
y=C{2};

plot(months, y), legend('originaldata'), xlabel('months'), ylabel('number of sunspots'), title('SUNSPOTS '),