www.gusucode.com > stats 源码程序 matlab案例代码 > stats/InversePredictionExample.m

    %% Inverse Prediction
%% 
% Generate sample data.

% Copyright 2015 The MathWorks, Inc.

x = 4*rand(25,1);
y = 10 + 5*x + randn(size(x));
%% 
% Make a scatterplot of the data.
scatter(x,y)
%% 
% Predict the _x_ value for a given _y_ value of 20.
x0 = invpred(x,y,20)