Question: Matrices

Hi i'm trying to figure out how to write a procedure for creating a NxN matrix with conditions. The conditions for M[ij] are as follows:

a if j>i+1, c if i>j+1 and b otherwise.

So far this is what i've come up with but i've tied myself into a mental loop and cant seem to figure this out. I know it's really simple and that's what is frustrating me the most.

mat:= proc(a0,b0,c0,N0)
> local i,j,k,N,M:
> N:=N0:
> for k from 1 to N do Matrix(N,N):
> end do
> for i from 1 to N do
>   for j from 1 to N do
>     if j>(i+1) then M[i,j]:= a:
>     elif i>(j+1) then M[i,j]:= c:
>     else M[i,j]:= b:
>     end if:
>   end do:
> end do:
> > end proc:
mat(a,b,c,4);

Any help would be appreciated. Thanks.

Please Wait...