some problem in combine smoothing of different parameter?
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
I have 4 matrix x=latitude, y=longitude, t=time and M= result of 1024*966 dimension want to smooth result across latitude using polynomial fit, then again want to smooth across time using cosine fit, can you please tell me how can I do?
0 comentarios
Respuestas (1)
Image Analyst
el 29 de Ag. de 2013
Editada: Image Analyst
el 29 de Ag. de 2013
What is a cosine fit? You mean like a Fourier series?
If you want a global polynomial fit, you can take row by row and use polyfit() to smooth it. For each row (untested)
orderOfPolynomial = 4; % Whatever order you want.
M_smoothed = M; % Initialize
for rowNumber = 1 : rows
oneRow = M(rowNumber, :);
coeffs = polyfit(1:columns, oneRow, orderOfPolynomial);
smoothedData = polyval(coeffs, 1:columns);
M_smoothed(rowNumber, :) = smoothedData;
end
imshow(M_smoothed, []);
If you want a localized sliding window fit, you can use a Savitzky-Golay filter, which is done by the sgolay() function in the Signal Processing Toolbox. If you don't have that toolbox, then you'll have to write it yourself using polyfit() over short sequences inside the window at each position, or see this. I also have a demo for sgolay() if you (or anyone else) have the Signal Processing Toolbox and want a demo.
6 comentarios
Image Analyst
el 29 de Ag. de 2013
Editada: Image Analyst
el 29 de Ag. de 2013
Explain what you're doing with x1, y1, xx, and xxx. And again, you need to pass S and mu into polyval().
Ver también
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!