Extracting points from an interpolated surface (Lowess fit)

6 views (last 30 days)
Hey Guys,
I have made a surface using the lowess fit from a non uniform set of data points. I am only able to read points from the surface only using the interactive data cursor by manually clicking on points.
I wanted to be able to extract points on the interpolated surface feeding in the x,y coordinates and extracting the z - coordinate. Please find the code below that I'm using.
Thanks in advance,
Hamed
Ratings = xlsread('SpreadMatrixFrontEnd10.xlsx','Consumer Goods122','B2:B122');
DTM = xlsread('SpreadMatrixFrontEnd10.xlsx','Consumer Goods122','A2:A122');
Yield = xlsread('SpreadMatrixFrontEnd10.xlsx','Consumer Goods122','C2:C122');
w= xlsread('SpreadMatrixFrontEnd10.xlsx','Consumer Goods122','D2:D122');
[xInput, yInput, zOutput, weights] = prepareSurfaceData( Ratings, DTM, Yield, w );
% Set up fittype and options.
ft = fittype( 'lowess' );
opts = fitoptions( ft );
opts.Span = 0.9;
opts.Weights = weights;
opts.Normalize = 'on';
% Fit model to data.
[fitresult, gof] = fit( [xInput, yInput], zOutput, ft, opts );
% Plot fit with data.
figure( 'Name', 'Consumer Goods' );
h = plot( fitresult, [xInput, yInput], zOutput );
% Label axes
xlabel( 'Ratings' );
ylabel( 'DTM' );
zlabel( 'Yield' );
grid on

Accepted Answer

Teja Muppirala
Teja Muppirala on 11 Jul 2012
You can directly call your FIT object with the points you want to evaluate. Like this:
fitresult(3,4)
fitresult([1 2 3],[5 10 15])

More Answers (1)

Walter Roberson
Walter Roberson on 29 Jul 2012

Products

Community Treasure Hunt

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

Start Hunting!