You are on page 1of 3

clear,clc;

syms w
t=1975:1:2004;
y=[16 13 28 93 155 155 140 116 67 46 18 13 29 100 158 143 146 94 55 30 18 9 21 64 93 119 111 104 64 40];
[t' y']
plot(t,y)
A=(max(y)-min(y))/2
B=(max(y)+min(y))/2
w=2*pi/11
syms c
c=solve(y(1)-A*cos(w*t(1)+c)-B,c)
syms t
y=A*cos(w*t+c(1))+B
hold on
fplot(char(y),[1974 2004],'r')

ans =
1975

16

1976

13

1977

28

1978

93

1979

155

1980

155

1981

140

1982

116

1983

67

1984

46

1985

18

1986

13

1987

29

1988

100

1989

158

1990

143

1991

146

1992

94

1993

55

1994

30

1995

18

1996

1997

21

1998

64

1999

93

2000

119

2001

111

2002

104

2003

64

2004

40

A=
74.5000

B=
83.5000

w=
0.5712

c=
(21*pi)/11 + acos(135/149)
(21*pi)/11 - acos(135/149)

y=
(149*cos((21*pi)/11 + acos(135/149) + (2*pi*t)/11))/2 + 167/2

Published with MATLAB R2013b

You might also like