vpasolve not finding solutions (multiple variables in matrix form)

4 visualizaciones (últimos 30 días)
I am trying to use vpasolve to find solutions to a set of equations, I've created an MWE to show the problem. I have two vectors (Ra and Re) that I want to find. In the MWE below vpasolve returns empty symbolic structs (no solutions, but I know at least one solution exsists), but if I remove one vector (say by stating Ra) then vpasolve finds the unknown Re sucessfully. I've struggled to work out how to set initial guesses when there are 2 (4x1) symbolic variables to see if this will help.
Thanks,
Ben
% Matrix solution to impedance problem
% Ra and Re are the axial and electrode impedances
%Ra12=0.2, Ra23=0.3, Ra34=0.4, Rext=0.1
%Re1=1, Re2=2, Re3=3, Re4=4.
%given these values, the measured resistances would be:...
Z=[3.16;4.25;5.09;5.21;6.21;7.24]
% Define symbolic vector for Ra
Ra=sym('Ra',[4,1])
%Ra = [0.2, 0.3, 0.4, 0.1]';
% Zt is the sume of all Ra
Zt=[1,1,1,1]*Ra
Re=sym('Re',[4,1])
%Re = [1, 2, 3, 4]';
A=[1 1 0 0; 1 0 1 0; 1 0 0 1; 0 1 1 0; 0 1 0 1; 0 0 1 1]
B=[1 0 0 0; 1 1 0 0; 1 1 1 0; 0 1 0 0; 0 1 1 0; 0 0 1 0]
C=ones(size(B))-B
F=Z-A*Re
G=B*Ra
H=C*Ra
J=G.*H
% Solve
M = F*Zt==J;
S = vpasolve(M, [Ra, Re])

Respuestas (1)

Shiva Kalyan Diwakaruni
Shiva Kalyan Diwakaruni el 9 de Feb. de 2021
Hi,
Alternatively you can try using solve function instead of vpasolve which solves your problem.
please refer the below link for more information on solve
S = solve(M, [Ra, Re])
hope it helps,
thanks.

Etiquetas

Productos


Versión

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by