f



help! help!! help!!!

x=[0 1 10]
p=[100 80]
how can I get A

A=[3x(1)  2x(1)  x(1) 1   0         0       0   0;
   2x(1)   x(1)   1   0   0         0       0   0;
   3x(2)  2x(2)  x(2) 1 -3x(2)   -2x(2)  -x(2) -1;
   2x(2)   x(2)   1   0 -2x(2)    -x(2)    -1   0;
   p(1)x(1) p(1)  0   0 -p(2)x(2) -p(2)     0   0;
   p(1)     0     0   0   -p(2)     0       0   0;
   0        0     0   0  -p(2)x(3) -p(2)    0   0;
   0        0     0   0   -p(3)     0       0   0;
]
0
12/27/2007 12:37:17 AM
comp.soft-sys.matlab 211266 articles. 23 followers. lunamoonmoon (257) is leader. Post Follow

3 Replies
3348 Views

Similar Articles

[PageSpeed] 51

In article <fkus3t$11h$1@fred.mathworks.com>,
Jim lei <redlightlike@mathworks.com> wrote:
>x=[0 1 10]
>p=[100 80]
>how can I get A
>

>A=[3x(1)  2x(1)  x(1) 1   0         0       0   0;
>   2x(1)   x(1)   1   0   0         0       0   0;
>   3x(2)  2x(2)  x(2) 1 -3x(2)   -2x(2)  -x(2) -1;
>   2x(2)   x(2)   1   0 -2x(2)    -x(2)    -1   0;
>   p(1)x(1) p(1)  0   0 -p(2)x(2) -p(2)     0   0;
>   p(1)     0     0   0   -p(2)     0       0   0;
>   0        0     0   0  -p(2)x(3) -p(2)    0   0;
>   0        0     0   0   -p(3)     0       0   0;
>]


A=[3*x(1)  2*x(1)  x(1) 1   0         0       0   0; ...
   2*x(1)   x(1)   1   0   0         0       0   0; ...
   3*x(2)  2*x(2)  x(2) 1 -3*x(2)   -2*x(2)  -x(2) -1; ...
   2*x(2)   x(2)   1   0 -2*x(2)    -x(2)    -1   0; ...
   p(1)*x(1) p(1)  0   0 -p(2)*x(2) -p(2)     0   0; ...
   p(1)     0     0   0   -p(2)     0       0   0; ...
   0        0     0   0  -p(2)*x(3) -p(2)    0   0; ...
   0        0     0   0   -p(3)     0       0   0 ...
]
-- 
   "Beware of bugs in the above code; I have only proved it correct,
   not tried it."                                    -- Donald Knuth
0
roberson2 (8602)
12/27/2007 1:20:14 AM
"Jim lei" <redlightlike@mathworks.com> wrote in message 
<fkus3t$11h$1@fred.mathworks.com>...
 
 x=linapce(0,0.57 n)
 p=(100 80,n-1)
 how can I get A
 
 A=[
     x(1)  x(1)  x(1) 1   0         0       0   0;
>    x(1)  x(1)   1   0   0         0       0   0;
>    x(2)  x(2)  x(2) 1 -x(2)    -x(2)  -x(2) -1;
>    x(2)   x(2)   1   0 -x(2)    -x(2)    -1   0;
>    p(1)*x(1) p(1)  0   0 -p(2)*x(2) -p(2)     0   0;
>    p(1)     0     0   0   -p(2)     0       0   0;
>    0        0     0   0  -p(2)*x(3) -p(2)    0   0;
>    0        0     0   0   -p(2)     0       0   0;
> ]


0
12/27/2007 1:38:49 AM
"Jim lei" <redlightlike@mathworks.com> wrote in message 
<fkuvn9$d68$1@fred.mathworks.com>...
> "Jim lei" <redlightlike@mathworks.com> wrote in message 
> <fkus3t$11h$1@fred.mathworks.com>...
>  
> 
> 


ok, so which is it:
x=[0 1 10]
p=[100 80]
how can I get A

A=[3x(1) 2x(1) x(1) 1 0 0 0 0;
   2x(1) x(1) 1 0 0 0 0 0;
   3x(2) 2x(2) x(2) 1 -3x(2) -2x(2) -x(2) -1;
   2x(2) x(2) 1 0 -2x(2) -x(2) -1 0;
   p(1)x(1) p(1) 0 0 -p(2)x(2) -p(2) 0 0;
   p(1) 0 0 0 -p(2) 0 0 0;
   0 0 0 0 -p(2)x(3) -p(2) 0 0;
   0 0 0 0 -p(3) 0 0 0;
]

or this:

x=linapce(0,0.57 n)
p=(100 80,n-1)
A=[
    x(1)  x(1)  x(1) 1   0         0       0   0;
    x(1)  x(1)   1   0   0         0       0   0;
    x(2)  x(2)  x(2) 1 -x(2)    -x(2)  -x(2) -1;
    x(2)   x(2)   1   0 -x(2)    -x(2)    -1   0;
    p(1)*x(1) p(1)  0   0 -p(2)*x(2) -p(2)     0   0;
    p(1)     0     0   0   -p(2)     0       0   0;
    0        0     0   0  -p(2)*x(3) -p(2)    0   0;
    0        0     0   0   -p(2)     0       0   0;
 ]

in the first case it almost would have worked except you 
only had 2 elements for p but required a p(3) in the 
definition of A.  in the second case you have lost it 
completely.  linapce i don't recognize as a function in 
matlab, the arguments passed to it are incorrectly 
formatted, and the value assigned to p is a badly 
formatted command... so i recommend taking a deep breath, 
slow down, and start over.  Oh, and forget the !!! in the 
subject, your lack of proper planning doesn't make this 
any more important or interesting to anyone here.

0
dave7881 (1211)
12/27/2007 11:02:05 AM
Reply: