我有一个数据集,我想要拟合一条曲线。原始数据集包含3500到4100之间的值,步长为1.67。然后我想使用拟合曲线并找到一些其他x2值的y2值(例如300多个x2数据)。我怎么能在matlab中做到这一点?
答案 0 :(得分:1)
由于您的绘图看起来像一个简单的线性插值,您可以使用
fitfun(x)
定义函数x2
。然后用你的新newy2=fitfun(newx2);
值调用这个函数,我认为它应该直接与数组一起工作(结果将是一个相同大小的数组):
x2
注意边界:插值不能给你NaN
设置的域外的点,除非你告诉它说什么(默认的越界值是<div class="container">
<div class="row">
<div class="col-xs-6 col-xs-12 col-md-3">
<div class="thumbnail">
<img src="http://i.imgur.com/OcrRV00.jpg" alt="photogenic kitten">
<div class="caption">
<h3>The cutest kitten in the world has no time for bubbles.</h3>
<p>What...</p>
<p><a href="#" class="btn btn-primary" role="button">Pet him</a> <a href="#" class="btn btn-default" role="button">Don't pet him</a>
</p>
</div>
</div>
</div>
<div class="col-xs-6 col-xs-12 col-md-3">
<div class="thumbnail">
<img src="http://i.imgur.com/OcrRV00.jpg" alt="photogenic kitten">
<div class="caption">
<h3>The cutest kitten in the world has no time for bubbles.</h3>
<p>What...</p>
<p><a href="#" class="btn btn-primary" role="button">Pet him</a> <a href="#" class="btn btn-default" role="button">Don't pet him</a>
</p>
</div>
</div>
</div>
<div class="col-xs-6 col-xs-12 col-md-3">
<div class="thumbnail">
<img src="http://i.imgur.com/OcrRV00.jpg" alt="photogenic kitten">
<div class="caption">
<h3>The cutest kitten in the world has no time for bubbles.</h3>
<p>What...</p>
<p><a href="#" class="btn btn-primary" role="button">Pet him</a> <a href="#" class="btn btn-default" role="button">Don't pet him</a>
</p>
</div>
</div>
</div>
<div class="col-xs-6 col-xs-12 col-md-3">
<div class="thumbnail">
<img src="http://i.imgur.com/OcrRV00.jpg" alt="photogenic kitten">
<div class="caption">
<h3>The cutest kitten in the world has no time for bubbles.</h3>
<p>What...</p>
<p><a href="#" class="btn btn-primary" role="button">Pet him</a> <a href="#" class="btn btn-default" role="button">Don't pet him</a>
</p>
</div>
</div>
</div>
</div>
</div>
,我想)