当前位置:网站首页>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 !
边栏推荐
- Jetpack Compose 远不止是一个UI框架这么简单~
- jdbc数据库连接池使用问题
- 根据IP获取地市
- 怎样查找某个外文期刊的文献?
- LM11丨重构K线构建择时交易策略
- MySQL SQL的完整处理流程
- Redhat5 installing vmware tools under virtual machine
- leetcode 509. Fibonacci Number(斐波那契数字)
- JVM in-depth
- C interview encryption program: input plaintext by keyboard, convert it into ciphertext through encryption program and output it to the screen.
猜你喜欢
随机推荐
学术报告系列(六) - Autonomous Driving on the journey to full autonomy
2018年江苏省职业院校技能大赛高职组“信息安全管理与评估”赛项任务书第一阶段答案
Redhat5 installing vmware tools under virtual machine
C language interview to write a function to find the first occurrence of substring m in string n.
Programmers' daily | daily anecdotes
肿瘤免疫治疗研究丨ProSci LAG3抗体解决方案
使用net core优势/为什么使用
JVM in-depth
Abnova 体外转录 mRNA工作流程和加帽方法介绍
工具类:对象转map 驼峰转下划线 下划线转驼峰
dolphinscheduler3. X local startup
Go straight to the 2022ecdc fluorite cloud Developer Conference: work with thousands of industries to accelerate intelligent upgrading
AddressSanitizer 技术初体验
Linear algebra (1)
Abnova 膜蛋白脂蛋白体技术及类别展示
Networkx绘图和常用库函数坐标绘图
sqlserver多线程查询问题
MYSQL binlog相关命令
[opencv] morphological filtering (2): open operation, morphological gradient, top hat, black hat
linux系统rpm方式安装的mysql启动失败









