matlab 函数拟合现有60组数据,每组数据有20480个数据点.每组数据的x均为1/2046,2/2046,3/2046.20460/2046,而y的取值如图,每一列为一组y的取值,因此excel中现有20460行60列数.求大神帮忙编一个matlab程序,能
来源:学生作业帮助网 编辑:作业帮 时间:2024/11/24 21:41:21
matlab 函数拟合现有60组数据,每组数据有20480个数据点.每组数据的x均为1/2046,2/2046,3/2046.20460/2046,而y的取值如图,每一列为一组y的取值,因此excel中现有20460行60列数.求大神帮忙编一个matlab程序,能
matlab 函数拟合
现有60组数据,每组数据有20480个数据点.每组数据的x均为1/2046,2/2046,3/2046.20460/2046,而y的取值如图,每一列为一组y的取值,因此excel中现有20460行60列数.求大神帮忙编一个matlab程序,能把excel数据导入,并计算出60组A,B的取值.十分急,
matlab 函数拟合现有60组数据,每组数据有20480个数据点.每组数据的x均为1/2046,2/2046,3/2046.20460/2046,而y的取值如图,每一列为一组y的取值,因此excel中现有20460行60列数.求大神帮忙编一个matlab程序,能
clear all;clc
x=1940:1:1996;
x=x';
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=y';
f=fittype('a*sin(b*x+c)','independent','x','coefficients',{'a','b','c'});
cfun=fit(x,y,f)
xi=1940:1:1996;
yi=cfun(xi);
plot(x,y,'r*',xi,yi,'b-')
自己改一下x,y的数据,直接运行即可!