Solve maximum number of variables possible in multiple equations

3 views (last 30 days)
Hello,
For my research project for Mechanical Engineering, i'm designing an Excel-spreadsheet, with a link to Matlab.
Reason for this is: I want to be able to put in any variable, and let matlab calculate the maximum number of variables as possible, by solving given equations. This is important because with the research, we don't know yet which variables we want to input.
Example: 3 equations:
c=a*b
f=d+e
g=c/f
When, for instance, I have a value for a, b, d & g, it is possible to determine all variables. (a&b gives c, then f can be calculated with c&g, and then e can be determined by solving f=d+e)
But also, when I only have c&g, I want to be able to calculate f (and give an error for a,b,d,e)
For starters, I want to get this to work in Matlab only. I'll be able to figure out the 'link with Excel'-part myself.
With what I've managed so far, i'm able to calculate g when enough variables are supplied (eg. a,b,d,f), but it doesn't work the other way around. In other words, it solves the equations in a given order(starts with the first equation) and runs into an error when not enough variables are supplied.
I've been working on this for a few days now, but I can't quite figure it out to get it right. Thanks in advance,
Erik
edit another example
solve(a*b-c:c/f-g:d+e-f)
Error using sym/colon (line 27)
Cannot compute the number of steps from 5*b - 5 to e - f + 5 by 5/f - 5.
In these equations, it was needed to obtain b,e & f.

Answers (0)

Community Treasure Hunt

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

Start Hunting!