Please, Need help on MATLAB!!!!!!!!!

edited October 2008 in Science & Tech
Write a script/function that does the following:

It takes a matrix, of arbitrary size (m x 1, 1 x n, or m x n), and computes an output matrix of identical size.

The i, jth element of the output is equal to the sum of all the surrounding elements of the i, jth element of the input matrix.

For elements on the edge and corner of the input matrix there will be fewer elements to add.

Examples:

[1 0]
> [0 1]





[1 0;
> [1 2;
0 1]
> 2 1]





[0 0 0;
> [1 1 1;
0 1 0;
> 1 0 1;
0 0 0]
> 1 1 1]

Comments

  • shwaipshwaip bluffin' with my muffin Icrontian
    edited October 2008
    If I do your homework now, how do you expect to pass tests?
Sign In or Register to comment.