substitute numeric matrix into symbolic expression
Ältere Kommentare anzeigen
hi, im using symbolic matrixes (WW is 2by 1 and x is 3 by 1) to calculate the sum of the product of WW*x(1) +WW*x(2)... and put it in a matrix,this works fine but when i try to substitute the symbolic matrixes by numeric ones the result remains in function of WW and x even after WW and x are numeric in workspace and when i sue eval() it says undefind function or variable WW1 wich is awkward cause i can see it there in workspace
%initiate data
P=3;
m=1;
n=2;
N=1;
P=3;
m=1;
n=2;
N=1;
u=0;%u is the middle variant
%definning symbolic variables (matrix variables)
WW=sym('WW', [n,m])
x=sym('x', [P,m])
for p=1:P
for j=1:n
u=0
for k=1:m
u=u+WW(j,k)*x(p,k) %calculation of sum
end
net(p,j)=u
end
end
%definning symbolic variables (matrix variables)
subs(net,WW(1),double(1))
subs(net,x(1),1)
%another try
x=[1 ;1; 1]
WW=[1 ;1]
ev= eval(net)

1 Kommentar
@aziz dattebayou: Please do not add comments and screen shots in Answers. Please do not accept your own answer that is not an answer to the question but only includes a screen shot. Please add any screenshots and new information in comments.
The Answers are for answering the question. Accepting an answer tells everyone that that answer resolves your question. So when you accept your own "Answer" then you are telling everyone that you do not need any more help.
I moved your screenshot to your question and deleted your "Answer" that was not really an answer.
Akzeptierte Antwort
Weitere Antworten (0)
Kategorien
Mehr zu Number Theory finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!