Matlab interp2外推

时间:2016-01-28 15:02:07

标签: matlab extrapolation

我正在使用interp2进行二维插值。对于某些数据值, interp2命令返回NaN,因为其中一个维度在外面 由已知值的向量定义的范围。

可以使用interp1命令进行推断。但是,是 有没有办法为interp2

执行此操作

由于

以下是我使用interp2命令的代码:

function [Cla] = AirfoilLiftCurveSlope(obj,AFdata,Rc,M)

% Input:
% AFdata: Airfoil coordinates.
% Rc: Local Reynolds number.
% M: Mach number for Prandtle Glauert compressibility correction.

% Output: 
% Cla: 2 dimensional lift curve slopea applicable to linear region of lift polar.

load('ESDU84026a.mat');

xi = size(AFdata);

if mod(xi(1,1),2) == 0
    %number is even
    AFupper = flipud(AFdata(1:(xi(1,1)/2),:));
    AFlower = AFdata(((xi(1,1)/2)+1):end,:);
else
    %number is odd
    AFupper = flipud(AFdata(1:floor((xi(1,1)/2)),:));
    AFlower = AFdata((floor(xi(1,1)/2)+1):end,:);
end


t_c = Airfoil.calculateThickness(AFdata(:,2));

Y90 = ((interp1(AFupper(:,1),AFupper(:,2),0.9,'linear')) - (interp1(AFlower(:,1),AFlower(:,2),0.9,'linear')))*100;

Y99 = ((interp1(AFupper(:,1),AFupper(:,2),0.99,'linear')) - (interp1(AFlower(:,1),AFlower(:,2),0.99,'linear')))*100;

Phi_TE = (2 * atan( ( (Y90/2) - (Y99/2) )/9))*180/pi;                       % Degrees
Tan_Phi_Te = ( (Y90/2) - (Y99/2) )/9;

Cla_corr = interp2(Tan_Phi,Rc_cla,cla_ratio,Tan_Phi_Te,Rc,'linear');

beta =sqrt((1-M^2));                                                        % Prandtle Glauert correction
Cla_theory = 2*pi + 4.7*t_c*(1+0.00375 * Phi_TE);                           % per rad 
Cla = (1.05/beta) * Cla_corr * Cla_theory;                                  % per rad

if isnan(Cla) == 1 %|| Cla > 2*pi
    Cla = 2*pi;
end

end

2 个答案:

答案 0 :(得分:5)

是的,有两种方法可以让#in the show.html.erb <% @pitches.each do |p| %> <%= form_tag book_pitch_path(p) do %> #your attributes here <%= submit_tag "Book this Pitch" %> <% end %> <% end %> #routes.rb post :book_pitch/:id, to: 'pitches/book_pitch', as: 'book_pitch' #in pitches_controller.rb def book_pitch #your actions here end 根据the docs返回超出界限的有意义的值。

  1. 使用interp2插值方法。与选项#2不同,这实际上将根据样条曲线的边界条件推断数据。
  2. 指定最终的'spline'参数。对于所有其他插值方法,将返回此常量而不是extrapval
  3. 不幸的是,似乎没有办法指定诸如“网格上的最近邻居”之类的东西。如果越界元素靠近边缘,也许你可以只扩展输入数组。例如:

    NaN

答案 1 :(得分:0)

嘿,请找到我的interp2代码,它只接受最大绑定值;

                Org          New
0  14_ddc_-_systems  ddc systems
1  14_ddc_-_systems  ddc systems
2        23_kbf_org      kbf org

);