当前位置:网站首页>捡起MATLAB的第(8)天
捡起MATLAB的第(8)天
2022-04-23 15:54:00 【Sola_Ex】
捡起MATLAB的第八天
Matlab
一维线性插值
一维插值命令
%x:原始数据(自变量)n维向量
%v:原始数据(函数值)n维向量
%xq:插值(自变量)可以使一个点,也可以是向量
%vq:插值结果(函数值)
vq = interp1(x,v,xq)
vq = intterp1(x,v,xq,method)
method的方法
2014a版本的matlab目前有这几种方法:
举例1 — 插值法:
实现脚本代码如下:
production = [75.995 ... .... ..] %此处省了,实则是产量的值
years = 1900:10:2010; %设置年份区间
x = 1900:2010;
p_res = interp1(years,production,x,'spline')
plot(years,production,'o',x,p_res)
运行就可以得到一个连续的线。
举例2 — 插值法:
实现脚本代码如下:
x = 0:2:24;
y = [....] %温度的值
% 注意:x和y的维度要一样,形成一一对应关系
x1 = 0:1/3600:24 %单位化成秒,增量为1s
strmethod={
'nearest',...} %方法
strlb={
'{a}method=nearest',...} %对应上方的方法
for i=1:6
y1 = interp1(x,y,x1,strmethod{
i});
subplot(3,2,i) %切割出3*2张图
plot(x,y,'ro',x1,y1,'b''linewith',1.5)
xlabel(strlb)
end
效果如下:
版权声明
本文为[Sola_Ex]所创,转载请带上原文链接,感谢
https://blog.csdn.net/qq_42312125/article/details/107743835
边栏推荐
- Control structure (I)
- 字符串排序
- Tencent offer has been taken. Don't miss the 99 algorithm high-frequency interview questions. 80% of them are lost in the algorithm
- shell脚本中的DATE日期计算
- Cap theorem
- Multi level cache usage
- Implement default page
- How do you think the fund is REITs? Is it safe to buy the fund through the bank
- 【开源工具分享】单片机调试助手(示波/改值/日志) - LinkScope
- Best practices of Apache APIs IX high availability configuration center based on tidb
猜你喜欢
Neodynamic Barcode Professional for WPF V11. 0
5分钟,把你的Excel变成在线数据库,神奇的魔方网表excel数据库
Unity shader learning
时序模型:长短期记忆网络(LSTM)
Spark 算子之sortBy使用
The biggest winner is China Telecom. Why do people dislike China Mobile and China Unicom?
Spark 算子之groupBy使用
C language --- advanced pointer
Tencent offer has been taken. Don't miss the 99 algorithm high-frequency interview questions. 80% of them are lost in the algorithm
IronPDF for . NET 2022.4.5455
随机推荐
Configuration of multi spanning tree MSTP
现在做自媒体能赚钱吗?看完这篇文章你就明白了
TIA博图——基本操作
js正则判断域名或者IP的端口路径是否正确
Open source project recommendation: 3D point cloud processing software paraview, based on QT and VTK
腾讯Offer已拿,这99道算法高频面试题别漏了,80%都败在算法上
Import address table analysis (calculated according to the library file name: number of imported functions, function serial number and function name)
Spark 算子之filter使用
leetcode-396 旋转函数
PS add texture to picture
实现缺省页面
Modèle de Cluster MySQL et scénario d'application
JS regular determines whether the port path of the domain name or IP is correct
Tencent offer has been taken. Don't miss the 99 algorithm high-frequency interview questions. 80% of them are lost in the algorithm
gps北斗高精度卫星时间同步系统应用案例
IronPDF for . NET 2022.4.5455
R语言中绘制ROC曲线方法二:pROC包
[AI weekly] NVIDIA designs chips with AI; The imperfect transformer needs to overcome the theoretical defect of self attention
Go语言条件,循环,函数
Best practices of Apache APIs IX high availability configuration center based on tidb