MATLAB: How to create a Filter that takes out irrelevant data

filter designmatrix

Hey everyone,
So I have a large amount of data stored in a matrix that displays the surface of an object when plotted. The only problem is that this contains the whole surface, and not just the roughness curve that I need from it. How can I create a filter (i'm guessing of a gaussian type) that controls the data being output? I don't need code to be provided, just simple direction would be nice.
I had an idea for where to start but I'm not sure if it's right.
A = imread('file_name.txt'); H = fspecial('gaussian',hsize,std)
The thing about this fspecial function is that I do not know what size to specify in the argument. The documentation does not cover this unfortunately.
Thanks, Ian

Best Answer

The curve fitting toolbox can help you deal with irregular data. Here I make a noisy surface, approximate it using polynomials, subtract the two, and then display the noise. There is a neat surface fitting GUI tool called "sftool" as well.

x = rand(65000,1);
y = rand(65000,1);
z0 = log(1+x).*sin(3*y);
z = z0 + 0.05*randn(size(z0));
figure
plot3(x,y,z,'k.','markersize',1);
hold on;
F = fit([x y],z,'poly55');
plot(F);
alpha 0.5;
figure
subplot(211)
plot3(x,y,F(x,y) - z,'.','markersize',1);
subplot(212)
plot(F(x,y) - z);
Related Question