reduce number of variables !!

3 views (last 30 days)
mina k
mina k on 29 Apr 2013
In the code bellow I want to organize variables of a1,a2,a3 into a vector. But unfortunately I faced lots of unexpected errors.
It would be kind of u to help me
Thanks in advance :)
syms a1 a2 a3
y=a1+a2+a3
z=matlabFunction(y)
a1=x(1)
a2=x(2)
a3=x(3)
x=[1 2 3]
w=z(x)

Answers (1)

Walter Roberson
Walter Roberson on 29 Apr 2013
z = matlabFunction(y, 'vars', [a1, a2, a3]);
The result will take a vector.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!