Determining particular solution with matlab

  • Thread starter Neophyte
  • Start date
  • #1
44
0

Homework Statement



4 -2 0 -2 | 32
-2 4 -2 0 | 0
0 -2 4 -2 | 0
-2 0 -2 4 | -32


So I am trying to have matlab come up with the answer for this with a,b,c,d as arbitrary.

Homework Equations





The Attempt at a Solution



I have tried several things the latest being

for i=1:a,
x=eye(a)
for j=1:(b-1),

if i==j
x(i,j) = 0;
h = var*x;
h=h\B;
spread(:,j) = [h];

var is


4 -2 0 -2
-2 4 -2 0
0 -2 4 -2
-2 0 -2 4

previously I had tried to do something with rref() but I keep failing


Inf NaN NaN NaN
-4.0000 NaN NaN NaN
-8.0000 -4.0000 -Inf NaN
-12.0000 -8.0000 -4.0000 -Inf

that is the outcome of the posted =/

Am i missing a function that would be useful?
I just want to hardcode the answer in :redface:

The answer I wanted was
0 4
-4 0
-8 -4
12 -8
 

Answers and Replies

Related Threads on Determining particular solution with matlab

  • Last Post
Replies
1
Views
976
  • Last Post
Replies
0
Views
2K
  • Last Post
Replies
3
Views
3K
  • Last Post
Replies
5
Views
2K
  • Last Post
Replies
7
Views
3K
  • Last Post
Replies
0
Views
1K
  • Last Post
Replies
1
Views
552
Top