Wednesday, March 12, 2014

fitting 3d data

Imagine you have 2 variables and you want to create a regression model to predict the 3rd variables. for that you have two options:
1) use the surface fitting toolbox in matlab. enter the following command in the consol:
sftool
once it is launched, you would be able to provide your first and second variables as the factos for ceating the model and the 3rd variable as the predictor. You have also some options to fit different degree of polynomial and see how you model would be.


2) use the command line function to create the above model:
following command create a 3rd order polynomial fitting model using the data y1 and y2:
sf = fit([y1,y2],y3,'poly33')
this will plot your model and your training data:
plot(sf, [y1,y2], y3)

if you want to exclude a range of data at the time of creating model do this:
sf = fit([y1,y2],y3,'poly33','Exclude', y2 < 5)

No comments:

Post a Comment