当前位置:网站首页>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 !
边栏推荐
- Jmeter 5.5版本发布说明
- MySQL卸载文档-Windows版
- Overview of FlexRay communication protocol
- Matlab / envi principal component analysis implementation and result analysis
- sqlserver多线程查询问题
- POI export to excel: set font, color, row height adaptation, column width adaptation, lock cells, merge cells
- MOS管参数μCox得到的一种方法
- 华为机试题素数伴侣
- Problems and precautions about using data pumps (expdp, impdp) to export and import large capacity tables in Oracle migration
- 工具类:对象转map 驼峰转下划线 下划线转驼峰
猜你喜欢

Force deduction 62 different paths (the number of all paths from the upper left to the lower right of the matrix) (dynamic planning)

Redis (II) - redis General Command

Take you to brush (niuke.com) C language hundred questions (the first day)

The latest trends of data asset management and data security at home and abroad

健身房如何提高竞争力?

Leite smart home longhaiqi: from professional dimming to full house intelligence, 20 years of focus on professional achievements

软件测试到了35岁,真的就干不动了吗?

网络基础 —— 报头、封装和解包

关于数据库数据转移的问题,求各位解答下

JWT certification
随机推荐
Postgresql中procedure支持事务语法(实例&分析)
JWT的基础介绍
MySQL (x)
Can't you really do it when you are 35 years old?
UIC (configuration UI Engineering) public file library adds 7 industry materials
Force deduction 62 different paths (the number of all paths from the upper left to the lower right of the matrix) (dynamic planning)
JVM in-depth
品牌·咨询标准化
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
企業如何進行數據治理?分享數據治理4個方面的經驗總結
MySQL的安装
华为机试题素数伴侣
Installing redis and windows extension method under win system
Abnova 体外转录 mRNA工作流程和加帽方法介绍
Apache ab 压力测试
Config分布式配置中心
场馆怎么做体育培训?
oracle如何备份索引
Several index utilization of joint index ABC
Wechat applet hides the progress bar component of the video tag