Using vpasolve to specify the variables not to solve for, or returning a struct with all zero values
4 views (last 30 days)
Show older comments
Background:
I am attempting to write code to implement finite element into a simple structure for an arbitrary number of nodes. I am implementing the principle equation (global stiffness matrix)*(vector of unknowns)=(vector of external loads)
https://en.wikipedia.org/wiki/Stiffness_matrix

I am solving for the trivial case of 3 nodes currently (bottom left, top left corner and top right) but need a generalised code. I can obtain the global stiffness matrix with no issues. I have had 2 unsuccessful attempts solving the unknowns and loads so far:
1: attempting to create all symbolic variables for fixed properties and symbolic vectors for loads and unknowns. I don't want vpasolve to attempt to solve for the constants (length, height, modulus, etc..) only for the value in the load vectors. I don't know how to explicitly state the variables when the symbolic vectors are of changing size.
This code does not work. neither does letting symvar determine my variables
[sol,sol2]=vpasolve(global_matrix*unknowns_sym==loads_sym,[loads_sym, unknowns_sym],100);
Approach 2: assigning the values of all material properties and leaving only the unknown and load vectors as symbolic variables: I get a struct with all the variables however values are incorrect. As far as I can tell there are 9 equations and 9 unknowns.
syms unknowns_sym loads_sym Rx Rm
unknowns_sym = sym('B', [total_nodes*3 1]);
unknowns_sym(1)=displacement;
unknowns_sym(2)=0;
unknowns_sym(7)=0;
unknowns_sym(9)=0;
loads_sym = sym('A', [total_nodes*3 1]);
loads_sym(2)=0;
loads_sym(3)=0;
loads_sym(4)=0;
loads_sym(5)=0;
loads_sym(6)=0;
loads_sym(7)=Rx;
loads_sym(8)=0;
loads_sym(8)=Rm;
sol=vpasolve(global_matrix*unknowns_sym==loads_sym,100);
entire m file is attached
is there some way i am misusing vpasolve? is there a way to specify which variables NOT to solve for in solve/vpasolve?
is this solution of matrices this way a good approach?
the condition of the global matrix is infinite, so i suspect this could also be a cause of this error. (mathematically not sure if this is as expected for this matrix, but solutions via inverse of matrix division do not work, hence my smybolic attempt)
0 Comments
Answers (1)
Walter Roberson
on 16 Sep 2017
vpasolve() is only for numeric solutions. It uses a newton-type method if I recall. The number of variables being solved for must match the number of independent equations; numeric values are looked for that satisfy everything.
0 Comments
See Also
Categories
Find more on Symbolic Math Toolbox in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!