matlab 三角函数拟合
来源:学生作业帮 编辑:神马作文网作业帮 分类:综合作业 时间:2024/11/10 17:09:57
matlab 三角函数拟合
现有一些数据,通过散点图来看可用三角函数拟合,提出的函数为
y=b1+b2*sin(b3*x+b4),如何用matlab来做回归以确定参数b1,b2,b3,b4的值,并分析拟合效果好不好.数据如下:
x
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
y
-0.016655576
-1.020497955
0.017169964
0.554703712
0.596023121
-0.120634468
-1.52482222
0.464829952
0.560474809
-1.4670432
0.422761195
1.217460974
0.626207521
-0.480855885
-0.89578382
-0.160632441
-0.749835829
-1.311194214
1.586347214
0.527346626
0.220631213
0.580634109
-0.251140179
0.231573505
-0.04921873
-0.706294671
-0.004742193
0.242011934
0.435841493
0.611978036
0.06467293
-0.208504853
-0.058353393
-0.238538448
-0.521458598
-0.028459852
0.486062691
0.284832859
-0.135216353
0.969707567
0.353067592
-0.31598282
-0.786987622
-0.342113681
0.460642652
0.078666352
-0.805211492
-0.89431641
1.402905025
0.269398263
0.082540636
-0.286023245
-0.471387156
-0.242563686
-0.896972212
0.295507787
-4.514914159
现有一些数据,通过散点图来看可用三角函数拟合,提出的函数为
y=b1+b2*sin(b3*x+b4),如何用matlab来做回归以确定参数b1,b2,b3,b4的值,并分析拟合效果好不好.数据如下:
x
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
y
-0.016655576
-1.020497955
0.017169964
0.554703712
0.596023121
-0.120634468
-1.52482222
0.464829952
0.560474809
-1.4670432
0.422761195
1.217460974
0.626207521
-0.480855885
-0.89578382
-0.160632441
-0.749835829
-1.311194214
1.586347214
0.527346626
0.220631213
0.580634109
-0.251140179
0.231573505
-0.04921873
-0.706294671
-0.004742193
0.242011934
0.435841493
0.611978036
0.06467293
-0.208504853
-0.058353393
-0.238538448
-0.521458598
-0.028459852
0.486062691
0.284832859
-0.135216353
0.969707567
0.353067592
-0.31598282
-0.786987622
-0.342113681
0.460642652
0.078666352
-0.805211492
-0.89431641
1.402905025
0.269398263
0.082540636
-0.286023245
-0.471387156
-0.242563686
-0.896972212
0.295507787
-4.514914159
到cftool工具里去拟合,里面有现成的函数让你选