现在在做一个模拟P2P查询的实验,查询成功率随着节点的不断增加震荡得比较厉害,请问有没有人会用MATLAB进行拟合,得到一条平滑的曲线?
x = 1024:100:10924;
y = [0.988,0.986,0.973,0.983,0.941,0.892,0.966,0.985,0.979,0.964,0.965,0.976,0.976,0.978,0.984,0.972,0.986,0.985,0.980,0.971,0.961,0.980,0.977,0.985,0.986,0.986,0.968,0.977,0.953,0.980,0.856,0.982,0.974,0.986,0.985,0.986,0.978,0.974,0.982,0.978,0.975,0.984,0.984,0.988,0.984,0.984,0.983,0.982,0.986,0.974,0.986,0.987,0.981,0.986,0.988,0.983,0.987,0.990,0.979,0.987,0.895,0.962,0.974,0.986,0.984,0.979,0.988,0.984,0.983,0.965,0.937,0.979,0.977,0.984,0.983,0.980,0.984,0.986,0.986,0.980,0.979,0.983,0.981,0.988,0.987,0.985,0.984,0.984,0.984,0.984,0.980,0.984,0.986,0.982,0.982,0.987,0.984,0.988,0.988,0.987];
Matlab如何拟合震荡的曲线?
答案:2 悬赏:50 手机版
解决时间 2021-12-22 18:14
- 提问者网友:龅牙恐龙妹
- 2021-12-22 02:03
最佳答案
- 五星知识达人网友:老鼠爱大米
- 2021-12-22 02:24
你可以插值试试,他用分段函数来描述复杂的曲线
代码如下:
x = 1024:100:10924;
y = [0.988,0.986,0.973,0.983,0.941,0.892,0.966,0.985,0.979,0.964,0.965,0.976,0.976,0.978,0.984,0.972,0.986,0.985,0.980,0.971,0.961,0.980,0.977,0.985,0.986,0.986,0.968,0.977,0.953,0.980,0.856,0.982,0.974,0.986,0.985,0.986,0.978,0.974,0.982,0.978,0.975,0.984,0.984,0.988,0.984,0.984,0.983,0.982,0.986,0.974,0.986,0.987,0.981,0.986,0.988,0.983,0.987,0.990,0.979,0.987,0.895,0.962,0.974,0.986,0.984,0.979,0.988,0.984,0.983,0.965,0.937,0.979,0.977,0.984,0.983,0.980,0.984,0.986,0.986,0.980,0.979,0.983,0.981,0.988,0.987,0.985,0.984,0.984,0.984,0.984,0.980,0.984,0.986,0.982,0.982,0.987,0.984,0.988,0.988,0.987];
t= 1024:1:10924;
p= interp1(x,y,t,'spline');
plot(x,y,'o',t,p);
不知道是否满意
代码如下:
x = 1024:100:10924;
y = [0.988,0.986,0.973,0.983,0.941,0.892,0.966,0.985,0.979,0.964,0.965,0.976,0.976,0.978,0.984,0.972,0.986,0.985,0.980,0.971,0.961,0.980,0.977,0.985,0.986,0.986,0.968,0.977,0.953,0.980,0.856,0.982,0.974,0.986,0.985,0.986,0.978,0.974,0.982,0.978,0.975,0.984,0.984,0.988,0.984,0.984,0.983,0.982,0.986,0.974,0.986,0.987,0.981,0.986,0.988,0.983,0.987,0.990,0.979,0.987,0.895,0.962,0.974,0.986,0.984,0.979,0.988,0.984,0.983,0.965,0.937,0.979,0.977,0.984,0.983,0.980,0.984,0.986,0.986,0.980,0.979,0.983,0.981,0.988,0.987,0.985,0.984,0.984,0.984,0.984,0.980,0.984,0.986,0.982,0.982,0.987,0.984,0.988,0.988,0.987];
t= 1024:1:10924;
p= interp1(x,y,t,'spline');
plot(x,y,'o',t,p);
不知道是否满意
我要举报
如以上回答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
点此我要举报以上问答信息
大家都在看
推荐资讯