How do I create a Filter that takes out irrelevant data?
显示 更早的评论
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
采纳的回答
更多回答(2 个)
Ben Mitch
2011-5-22
0 个投票
Hi Ian
There's some information missing from your question, but it sounds like you're looking to interpolate a large amount of data to summarize its form with a small data set.
If so, you might get some mileage out of interp2() and filter2(), if that's the case (interp() and filter() if your "surface" is 1-D). Use interp2() to get the value of your function on a high-resolution regular grid, then use filter2() to smooth it as much as you like (use a matrix of ones as "b" in filter2()), then use interp2() again (or simply decimate) to obtain a smoothed surface on a low-resolution regular grid.
If you need more control over the curvature of the summary surface, you could try instead polynomial estimation. Denote your input data [x, y] as X, and your output data [z] as Y, and use polyfit() to fit an nth-degree polynomial of your choice, then use polyval() to provide a summary data set on a regular grid.
Cheers
Ian Wood
2011-5-24
0 个投票
类别
在 帮助中心 和 File Exchange 中查找有关 Get Started with Curve Fitting Toolbox 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!