HELLO, I HAVE A QUESTION I have matrix, but the data is not good there, i need to use function Smooth. but when i try i get a problem every time. maybe someone has an exampl. how i can use smooth for matrix?
thanks
[SCd merged from Duplicate]
I have this task. we have a car with 15 elements in it. for each element i have a matrix of possible values. I need to use smooth for each matrix
Can you help me thanks

Antworten (2)

Wayne King
Wayne King am 22 Feb. 2012

1 Stimme

smooth operates a column vector, so you could loop over the columns of the matrix; I don't know how big your matrix is.
X = randn(100,100);
Y = zeros(size(X));
for nn = 1:100
Y(:,nn) = smooth(X(:,nn));
end

3 Kommentare

Dmitry
Dmitry am 22 Feb. 2012
i have this task. we have a car with 15 elements in it. for each element i have a matrix of possible values. I need to use smooth for each matrix
Wayne King
Wayne King am 22 Feb. 2012
That doesn't give me the size of the matrix
Dmitry
Dmitry am 22 Feb. 2012
4 matrix
189x3
22x2
366x2
345x2

Melden Sie sich an, um zu kommentieren.

Wayne King
Wayne King am 22 Feb. 2012

1 Stimme

From the part Sean merged in, perhaps it doesn't make sense in your application to smooth the columns of the matrix separately. Maybe you want filter the entire matrix at once.
Here just using one possible lowpass filter.
h = [-0.0758 -0.0296 0.4976 0.8037 0.2979 -0.0992 -0.0126 0.0322]';
h = h*h';
X = randn(10,10);
Y = filter2(h,X);
basically you can use any number of lowpass FIR filters including a strict moving average filter. Again, without knowing your application, it's difficult to say which smoothing method is most appropriate.

4 Kommentare

Dmitry
Dmitry am 22 Feb. 2012
189x3
22x2
366x2
345x2
Wayne King
Wayne King am 22 Feb. 2012
so maybe it makes sense to filter the columns separately as I showed you how to do in my first post. I don't know, are the spatial characteristics encoded in the matrix of significance or do just the columns matter?
Dmitry
Dmitry am 22 Feb. 2012
exampl
73572e+05 64
73571e+05 73
Dmitry
Dmitry am 23 Feb. 2012
size -
189x3
22x2
366x2
345x2
data
73572e+05 64
73571e+05 73

Melden Sie sich an, um zu kommentieren.

Tags

Gefragt:

am 22 Feb. 2012

Bearbeitet:

am 20 Okt. 2013

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by