当前位置:网站首页>Matlab tips (29) polynomial fitting plotfit
Matlab tips (29) polynomial fitting plotfit
2022-07-07 06:50:00 【mozun2020】
MATLAB Tips (29) Polynomial fitting plotfit
Preface
MATLAB Learning about image processing is very friendly , You can start from scratch , There are many encapsulated functions that can be called directly for basic image processing , This series of articles is mainly to introduce some of you in MATLAB Some concept functions are commonly used in routine demonstration !
Polynomial fitting is to use a polynomial expansion to fit all observation points in a small analysis area containing several analysis lattice points , Get the objective analysis field of the observation data . The expansion coefficient is determined by least square fitting . However, the domain polynomial of this method is quasi merge unstable , This is especially true when data is missing , And it will cause the analysis to be discontinuous between the fitting regions .
When analyzing and predicting data , More common fitting methods , The fitting polynomial is obtained by the least square method , Thus, the predicted value of the parameter can be predicted , The example encountered when searching for data , Here to share , This article example simulation MATLAB Version is MATLAB2015b.
One . MATLAB Simulation
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% function : Polynomial fitting
% Environmental Science :Win7,Matlab2015b
%Modi: C.S
% Time :2022-06-28
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% I. Clear environment variables
clear all
clc
tic
y=[100.3 101.1 102.1 101.1 101.6 104.4 102.5 102.1 103.9 103.9];
x=1:length(y);
A=polyfit(x,y,2) %2 Secondary phase fitting , This 2 Modifiable Model coefficients
Z=polyval(A,x); % forecast y
len=[1:20];
len1=polyval(Z,len); % Predict the trend
result=[y;Z]% Actual value and predicted value
error=abs(y-Z);% error
bfb=error./y% Relative error
errorsum=sum(error)/length(y)% Average error
bfbsum=sum(bfb)/length(y)% Average relative error
figure(1)
plot(x,y,'r-',x,Z,'b-')
legend(' actual value ',' Fit value ')
title(' Comparison between actual value and predicted value ','fontsize',15)
ylabel('Y','fontsize',15)
xlabel('X','fontsize',15)
figure(2)
plot(len,len1,'b-')
legend(' Fit the curve ')
title(' Fitting curve ','fontsize',15)
ylabel('Y','fontsize',15)
xlabel('X','fontsize',15)
toc
Two . Simulation results
A =
-0.0144 0.5159 100.0167
result =
100.3000 101.1000 102.1000 101.1000 101.6000 104.4000 102.5000 102.1000 103.9000 103.9000
100.5182 100.9909 101.4348 101.8500 102.2364 102.5939 102.9227 103.2227 103.4939 103.7364
bfb =
0.0022 0.0011 0.0065 0.0074 0.0063 0.0173 0.0041 0.0110 0.0039 0.0016
errorsum =
0.6300
bfbsum =
0.0061
Time has passed 2.561846 second .
3、 ... and . Summary
Simulation example of polynomial fitting , It may be used later , Take a note here . Learn one every day MATLAB Little knowledge , Let's learn and make progress together !
边栏推荐
- 工具类:对象转map 驼峰转下划线 下划线转驼峰
- js装饰器@decorator学习笔记
- DB2获取表信息异常:Caused by: com.ibm.db2.jcc.am.SqlException: [jcc][t4][1065][12306][4.25.13]
- RuntimeError: CUDA error: CUBLAS_STATUS_ALLOC_FAILED when calling `cublasCreate(handle)`问题解决
- Apache ab 压力测试
- 拼多多败诉:“砍价免费拿”侵犯知情权但不构成欺诈,被判赔400元
- Abnova 膜蛋白脂蛋白体技术及类别展示
- Problems and precautions about using data pumps (expdp, impdp) to export and import large capacity tables in Oracle migration
- 2022 Android interview essential knowledge points, a comprehensive summary
- 大促过后,销量与流量兼具,是否真的高枕无忧?
猜你喜欢
MYSQL----导入导出&视图&索引&执行计划
String (explanation)
2022 Android interview essential knowledge points, a comprehensive summary
SVN version management in use replacement release and connection reset
联合索引ABC的几种索引利用情况
Mysql---- import and export & View & Index & execution plan
Answer to the first stage of the assignment of "information security management and evaluation" of the higher vocational group of the 2018 Jiangsu Vocational College skills competition
Abnova循环肿瘤DNA丨全血分离,基因组DNA萃取分析
毕业设计游戏商城
2018年江苏省职业院校技能大赛高职组“信息安全管理与评估”赛项任务书第一阶段答案
随机推荐
Force deduction 62 different paths (the number of all paths from the upper left to the lower right of the matrix) (dynamic planning)
Installing redis and windows extension method under win system
隐马尔科夫模型(HMM)学习笔记
使用TCP/IP四层模型进行网络传输的基本流程
Comment les entreprises gèrent - elles les données? Partager les leçons tirées des quatre aspects de la gouvernance des données
jdbc数据库连接池使用问题
MATLAB小技巧(29)多项式拟合 plotfit
「运维有小邓」符合GDPR的合规要求
Several index utilization of joint index ABC
Networkx绘图和常用库函数坐标绘图
MYSQL----导入导出&视图&索引&执行计划
C language interview to write a function to find the first occurrence of substring m in string n.
2018年江苏省职业院校技能大赛高职组“信息安全管理与评估”赛项任务书第一阶段答案
MOS管参数μCox得到的一种方法
Redis (I) -- getting to know redis for the first time
How can I check the DOI number of a foreign document?
MYSQL binlog相关命令
Data of all class a scenic spots in China in 2022 (13604)
Abnova 免疫组化服务解决方案
联合索引ABC的几种索引利用情况