matlab离散点做曲线v11 = [ 0,3.44,6.86,10.3,12.3,13.6,14.3,16.8,19.0,20.1,23.8,26.7,31.1,35.0];Pk1 = [ 21804.0,17561.0,16075.0,13631.0,12436.0,11630.0,11220.0,9147.6,7224.4,6718.4,6229.0,5384.2,4158.7,3016.6];clear D1;for k=1:length(Pk1)D1(k)=Pk
来源:学生作业帮助网 编辑:作业帮 时间:2024/11/15 06:06:35
matlab离散点做曲线v11 = [ 0,3.44,6.86,10.3,12.3,13.6,14.3,16.8,19.0,20.1,23.8,26.7,31.1,35.0];Pk1 = [ 21804.0,17561.0,16075.0,13631.0,12436.0,11630.0,11220.0,9147.6,7224.4,6718.4,6229.0,5384.2,4158.7,3016.6];clear D1;for k=1:length(Pk1)D1(k)=Pk
matlab离散点做曲线
v11 = [ 0,3.44,6.86,10.3,12.3,13.6,14.3,16.8,19.0,20.1,23.8,26.7,31.1,35.0];
Pk1 = [ 21804.0,17561.0,16075.0,13631.0,12436.0,11630.0,11220.0,9147.6,7224.4,6718.4,6229.0,5384.2,4158.7,3016.6];
clear D1;
for k=1:length(Pk1)
D1(k)=Pk1(k)/Gs;
end
hold on;
plot(v11,D1)
有没有办法把条曲线拟合为光滑的曲线,spline拟合不了
matlab离散点做曲线v11 = [ 0,3.44,6.86,10.3,12.3,13.6,14.3,16.8,19.0,20.1,23.8,26.7,31.1,35.0];Pk1 = [ 21804.0,17561.0,16075.0,13631.0,12436.0,11630.0,11220.0,9147.6,7224.4,6718.4,6229.0,5384.2,4158.7,3016.6];clear D1;for k=1:length(Pk1)D1(k)=Pk
第一,你的代码中没有给出Gs的值,我随机给了一个,完了你根据情况更改.
然后利用工具箱即可做多项式拟合,残差、预测等都可以做.
代码:
clear
clc
v11=[0,3.44,6.86,10.3,12.3,13.6,14.3,16.8,19.0,20.1,23.8,26.7,31.1,35.0];
Pk1=[21804.0,17561.0,16075.0,13631.0,12436.0,11630.0,11220.0,9147.6,7224.4,...
6718.4,6229.0,5384.2,4158.7,3016.6];
Gs=3;%测试值
clear D1;
for k=1:length(Pk1)
D1(k)=Pk1(k)/Gs;
end
hold on;
plot(v11,D1,'+')
运行完在工具箱里面点Tools/Basic Fitting即可选择多项式拟合栏(很面有很多你可以选择的,并可以按那些箭头展开右边).及残差预测等各系数都可以得到.
操作图发不了,给你放到私人信件里面吧,如果不行你可以给我个邮箱给你发具体操作形式图.
有问题可以继续追问.