当前位置:网站首页>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 !
边栏推荐
- Leetcode T1165: 日志分析
- 使用TCP/IP四层模型进行网络传输的基本流程
- MYSQL----导入导出&视图&索引&执行计划
- 二十岁的我4面拿到字节跳动offer,至今不敢相信
- Postgresql中procedure支持事务语法(实例&分析)
- Distributed ID solution
- [solution] final app status- undefined, exitcode- 16
- 2018年江苏省职业院校技能大赛高职组“信息安全管理与评估”赛项任务书第二阶段答案
- Installing redis and windows extension method under win system
- 地质学类比较有名的外文期刊有哪些?
猜你喜欢

2018年江苏省职业院校技能大赛高职组“信息安全管理与评估”赛项任务书第一阶段答案

Leetcode T1165: 日志分析

Mysql---- import and export & View & Index & execution plan

快速定量,Abbkine 蛋白质定量试剂盒BCA法来了!

MATLAB小技巧(29)多项式拟合 plotfit

拼多多败诉:“砍价免费拿”侵犯知情权但不构成欺诈,被判赔400元

BindingException 异常(报错)处理

基于JS的迷宫小游戏

SolidWorks的GB库(钢型材库,包括铝型材、铝管等结构)安装及使用教程(生成铝型材为例)

Etcd database source code analysis -- starting from the start function of raftnode
随机推荐
Redis (II) - redis General Command
【mysqld】Can't create/write to file
分布式id解决方案
请问如何查一篇外文文献的DOI号?
POI export to excel: set font, color, row height adaptation, column width adaptation, lock cells, merge cells
关于数据库数据转移的问题,求各位解答下
Abnova 体外转录 mRNA工作流程和加帽方法介绍
libcurl返回curlcode说明
Programmers' daily | daily anecdotes
华为机试题素数伴侣
精准时空行程流调系统—基于UWB超高精度定位系统
企業如何進行數據治理?分享數據治理4個方面的經驗總結
怎样查找某个外文期刊的文献?
HKUST & MsrA new research: on image to image conversion, fine tuning is all you need
程序员的日常 | 每日趣闻
MYSQL----导入导出&视图&索引&执行计划
Unable to debug screen program with serial port
Basic DOS commands
BindingException 异常(报错)处理
MySQL的安装