how can i extract the symbolic variable from a symbolic vector or matrix
4 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
I have a vector like something in attach file f0 and L was defined as two symbolic parameters. I want these parameters be like vector coefficient for [1/6;2/3;1/6] Thanks in advance
0 comentarios
Respuesta aceptada
M
el 5 de Dic. de 2017
syms f0 L
r=f0*L*[1/6;2/3;1/6];
r =
(L*f0)/6
(2*L*f0)/3
(L*f0)/6
and
var=symvar(r)
var =
[ L, f0]
2 comentarios
M
el 5 de Dic. de 2017
Editada: M
el 5 de Dic. de 2017
Not sure if it is the best way but you can try something like this :
syms f0 L
num=[1/6;2/3;1/6];
r=f0*L*num;
symbolicVariables=symvar(r)
symbolicVariables =
[ L, f0]
numericPart=zeros(length(r),1);
for i=1:length(r)
numericPart(i)=coeffs(r(i));
end
numericPart =
0.1667
0.6667
0.1667
Más respuestas (0)
Ver también
Categorías
Más información sobre Logical en Help Center y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!