Creating a matrix with some unknown and some known values

29 views (last 30 days)
I have to create matrices B and C which have some known values and some unknowns, and use them in an equation like A*B=C (A has all known values).
How can I define variables for these unknowns in Matlab and then solve for them? In other posts I saw that a few people have recommended using the sym function but I had trouble understanding how I can use it for my application. Any help is appriciated, thank you!

Accepted Answer

Star Strider
Star Strider on 26 Sep 2014
This is how I would do it:
syms A B C
B = sym('B%d%d', [3 3])
B(1,1) = 3; B(2,3) = 5; B(3,2) = 7;
A = randi(10,3,3);
C = A*B;

More Answers (0)

Community Treasure Hunt

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

Start Hunting!