フィルターのクリア

Extrapolation and estimation of data

506 ビュー (過去 30 日間)
Thomas
Thomas 2016 年 4 月 16 日
コメント済み: piston_pim_offset 2024 年 5 月 23 日
Hi,
I am trying to estimate a series of costs for various different batteries, I have costs for a series of capacities but I want to estimate the cost further than the maximum capacity and the cost at fractional capacities. I have tried using polyfit and polyval but if I use an order of 2 or higher I get negative value numbers. Here is an example of what I am trying to do,
%
bat1 = [3.6 6.4 10 14.4 18 32 50 72]; % Capacity of battery
cost1 = [400 500 600 700 900 1200 1500 1800]; % Cost of bat1 per respective capacity
NCap = linspace(1,100,50); % The capacities that I want to interpolate and extrapolate the cost to
I have also tried to use interp1 but I often get NaNs well within the range of bat1 and cost1. If anyone has any advice I would be grateful.

採用された回答

Star Strider
Star Strider 2016 年 4 月 16 日
This works:
bat1 = [3.6 6.4 10 14.4 18 32 50 72]; % Capacity of battery
cost1 = [400 500 600 700 900 1200 1500 1800]; % Cost of bat1 per respective capacity
NCap = linspace(1,100,50); % The capacities that I want to interpolate and extrapolate the cost to
cost1ext = interp1(bat1, cost1, NCap, 'linear', 'extrap');
figure(1)
plot(NCap, cost1ext, '--r')
hold on
plot(bat1, cost1)
hold off
grid
xlabel('Capacity')
ylabel('Cost')
You have to specify an interpolation method (here 'linear', but there are others) and then specify that you want to extrapolate. If you don’t add the method and 'extrap', the function returns NaN values for the extrapolated values.
  4 件のコメント
riadh euldji
riadh euldji 2021 年 6 月 22 日
hello dr :star strider i hope that your doing well
i have used your code on my data but it's gaves me negative value and the extrapolite value in my case shouled be positive
piston_pim_offset
piston_pim_offset 2024 年 5 月 23 日
@riadh euldji l have the exact problem.

サインインしてコメントする。

その他の回答 (2 件)

Bibhavari Bandyopadhyay
Bibhavari Bandyopadhyay 2019 年 11 月 29 日
Does anyone knows the algorithm behind extrapolating using spline?Need it urgently.
Thanks in advance.

Zain
Zain 2019 年 1 月 23 日
(Should I ask new question with similar title or is it better to leave my question here?)
Hi, I am having a problem with extrapolation of my data. I would like to expand my time series which is 170000 long for 9000 points from left and right side, but I am not sure how to do that. (I tried also with symetric expansion, and I saw that it is possible to use "polynomial regression continuation", but this polynomial solution I am not sure how to apply.)
Data looks like in the attached file(s). And results from 'pchip' and 'spline' extrapolation are also in the attachment.
When I apply interp1, non of methods provide good results. Should I do something before applying interp1? Is extrapolation actually good choice for data expansion?
  1 件のコメント
riadh euldji
riadh euldji 2021 年 6 月 22 日
hello sir i hop that you are doing well
i have same problem as yours
if you got any good resultes could help me sir ?

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeInterpolation についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by