On 30 Mrz., 21:18, "Michal Kolaj" <toomanybull...@hotmail.com> wrote:
> A,B,C and D are known m*n matrices and dx and dy are known constant scalers.
> I am attempting to solve for the m*n matrix R.
>
> D(i,j)=R(i,j)A(i,j) + (dR/dx)B(i,j) + (dR/dy)C(i,j)
>
> when m < i > 1 and n < j > 1:
> (dR/dx)=(R(i,j+1)R(i,j1))/2dx
> (dR/dy)=(R(i1,j)R(i+1,j))/2dy
>
> when i = 1
> (dR/dy)=(R(i,j)R(i+1,j))/dy
>
> when i = m
> (dR/dy)=(R(i1,j)R(i,j))/dy
>
> when j=1
> (dR/dx)=(R(i,j+1)R(i,j))/dx
>
> when j=m
> (dR/dx)=(R(i,j)R(i,j1))/dx
>
> 
> I am fairly new to matlab and I do not know how to approach this problem. Any help would be appreciated. I figured this could be done with a Ax=B solution but the size of the matrix would be huge as I would have many many x values (R values) and the majority of terms in matrix A would be 0. I also do not know of a simple way to convert my above data into such a matrix... other than doing it by hand...
>
> Thanks again
I think there is no way around in MATLAB: you will have to form matrix
A and vector B explicitely
and solve for x by x=A\B. MATLAB will take care of the banded
structure of your matrix A
to solve your system of equations efficiently.
In the LINPACK or LAPACK FORTRAN library, there is a special scheme to
store banded matrices,
but as far as I know, it is not supported in MATLAB.
Take care to include your boundary conditions for R at i=1, i=m, j=1
and j=n  otherwise your
system of equations will be singular.
Best wishes
Torsten.
