How can i generate a function using this points?
显示 更早的评论
采纳的回答
更多回答(1 个)
Cesar Antonio Lopez Segura
2018-8-29
Hi Here the solution:
% Your cloud point
x=[1,3,8,25,45,23];
y=[25,24,13,69,25,75];
% calculate a new cloud point that contain the last one
xnew = [1, 1.5 ,3,6,8,25,32,45,31,23];
ynew = interp1( x,y, xnew,'pchip' );
% plot de new values
plot(x,y,'o');hold on;plot( xnew, ynew,'r' )
% polinomios
p = interp1( x,y,'pchip' );
5 个评论
Mr. 206
2018-8-30
Cesar Antonio Lopez Segura
2018-8-30
编辑:Cesar Antonio Lopez Segura
2018-8-30
What is your MATLAB version ?
Your cloud point
x=[1,3,8,25,45,23]; y=[25,24,13,69,25,75];
[xtointerpol indx ] = sort(x);
ytointerpol = y(indx);
% calculate a new cloud point that contain the last one
ynew = interp1( xtointerpol,ytointerpol, xtointerpol, 'pchip' );
% plot de new values
close all
% plot(x,y,'+b');hold on;plot( xnew, ynew,'--or' )
plot(x,y,'+b');hold on;
plot( xtointerpol, ynew,'--or' )
% polinomios
p = pchip( xtointerpol,ytointerpol );
Mr. 206
2018-8-30
Mr. 206
2018-8-30
You can define x values in ascending order with sort.
Then you can order de y values.
[xtointerpol indx ] = sort(x);
ytointerpol = y(indx);
类别
在 帮助中心 和 File Exchange 中查找有关 Cloud Integrations 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!