symbolic vector multiplication
- From: junkyard@xxxxxxxxxxxxx
- Date: Fri, 29 Jun 2007 20:13:50 -0000
Hello,
I am new to the symbolic math toolbox, and I have a question regarding
vector multiplication. Suppose I have
syms a b c
f = a*b*c
if I want to evaluate this for the case where a and b are 1-D vectors
(for example, a = (1:10), b = 3*(1:10)) and c
is a scalar, how can I do this?
(If I were doing it staight from matlab, I would use: f = a.*b.*c, but
the symbolic expression won't let me use the . for array
multiplication)
If I try:
subs(f, {a,b,c},{(1:10),3*(1:10),4), I get the error message:
"Elements of the substitution cell array must be of the same size"
If I try:
a = (1:10)
b = 3*(1:10)
c = 4
eval(f)
I get the error message: "Inner matrix dimensions must agree."
if I transpose b and try it again, it works, but it has done matrix
multiplication, leaving me with a single value, not a vector result.
Is there a way to do this? Or, more specifically, is there a way to
do this that doesn't require looping through the vector elements?
thanks,
melissa
.
- Prev by Date: Re: Matlab Functions
- Next by Date: xpctarget communication
- Previous by thread: dir(ftp) output truncated
- Next by thread: xpctarget communication
- Index(es):