Extracting points from an interpolated surface (Lowess fit)
Show older comments
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
1 Comment
Walter Roberson
on 14 Jul 2012
Accepted Answer
More Answers (1)
Walter Roberson
on 29 Jul 2012
0 votes
Categories
Find more on Multivariate Models in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!