当前位置:网站首页>Day (8) of picking up matlab
Day (8) of picking up matlab
2022-04-23 15:54:00 【Sola_ Ex】
Pick up MATLAB The eighth day of
Matlab
One dimensional linear interpolation
One dimensional interpolation command
%x: Raw data ( The independent variables )n Dimension vector
%v: Raw data ( Function value )n Dimension vector
%xq: interpolation ( The independent variables ) Can make a point , It can also be a vector
%vq: Interpolation results ( Function value )
vq = interp1(x,v,xq)
vq = intterp1(x,v,xq,method)
method Methods
2014a Version of matlab At present, there are several methods :
give an example 1 — Interpolation method :
The implementation script code is as follows :
production = [75.995 ... .... ..] % Save here , In fact, it is the value of output
years = 1900:10:2010; % Set the year interval
x = 1900:2010;
p_res = interp1(years,production,x,'spline')
plot(years,production,'o',x,p_res)
Running can get a continuous line .
give an example 2 — Interpolation method :
The implementation script code is as follows :
x = 0:2:24;
y = [....] % Value of temperature
% Be careful :x and y The dimensions should be the same , Form a one-to-one correspondence
x1 = 0:1/3600:24 % In seconds , Increment of 1s
strmethod={
'nearest',...} % Method
strlb={
'{a}method=nearest',...} % Corresponding to the method above
for i=1:6
y1 = interp1(x,y,x1,strmethod{
i});
subplot(3,2,i) % Cut out 3*2 Pictures
plot(x,y,'ro',x1,y1,'b''linewith',1.5)
xlabel(strlb)
end
The effect is as follows :
版权声明
本文为[Sola_ Ex]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204231554163987.html
边栏推荐
- Date date calculation in shell script
- 捡起MATLAB的第(7)天
- 捡起MATLAB的第(9)天
- Modèle de Cluster MySQL et scénario d'application
- Calculate the number of occurrences of a character
- Spark 算子之filter使用
- [split of recursive number] n points K, split of limited range
- Redis master-slave replication process
- Go language, condition, loop, function
- MySQL Cluster Mode and application scenario
猜你喜欢
随机推荐
Named in pytoch_ parameters、named_ children、named_ Modules function
JVM - Chapter 2 - class loader subsystem
字符串最后一个单词的长度
The principle and common methods of multithreading and the difference between thread and runnable
Redis master-slave replication process
PHP function
运维流程有多重要,听说一年能省下200万?
Intersection, union and difference sets of spark operators
Spark 算子之distinct使用
Why is IP direct connection prohibited in large-scale Internet
Filter usage of spark operator
ESP32编译环境的搭建
Coalesce and repartition of spark operators
ESP32_Arduino
一刷313-剑指 Offer 06. 从尾到头打印链表(e)
Why disable foreign key constraints
The length of the last word of the string
【开源工具分享】单片机调试助手(示波/改值/日志) - LinkScope
实现缺省页面
Spark 算子之coalesce与repartition