三次函数插值

三次函数插值

调整数据,0调整为40,40调整为60,60调整为80,80调整为100,中间用三次函数插值。

实现过程如下

clear;
load('scoredata.mat');
score = sort(scoredata);
xi = 1:length(score);
x = 1:100;
figure(1)
plot(x,x,'ro');
xx = [0 40 60 100];
yy = [40 60 80 100];
p=polyfit(xx,yy,3);
y = polyval(p,x);
hold on
plot(x,y,'b*');
xlabel('原分数');
ylabel('调整分数');
scoref = polyval(p,score);
eta = length(find(score>60))./length(score) %及格率
etaf = length(find(scoref>60))./length(scoref) %调整及格率
figure(2)
plot(score,score,'ro');
hold on
plot(score,scoref,'b*')
plot(score,scoref-score,'g-')
legend('原分数','调整分数','加分量')
xlabel('原分数');
ylabel('分数分数');
zz = ceil(polyval(p,scoredata));

提供了一种调整分数的方法,感觉不是很合理

posted on 2021-03-30 11:49  MultiSimOpt  阅读(204)  评论(0)    收藏  举报

导航