MATLAB: Need help solving two unknown variable equations

solve

Hi, I'm new in matlab. I would like to ask your help how I can solve the unknown variables 'a' and 'b' from the below equations in matlab.
.
I tried using the below method
. .
syms a b
eqn_1 = 20*log((1 + ((20/a)^(2*b)))^(1/2))== 0.316;
eqn_2 = 20*log((1 + ((150/a)^(2*b)))^(1/2))==33;
sol = solve([eqn_1,eqn_2],[a,b]);
However, I could not get a returned value. I received a = a, b = b
.
Grateful for your help, and please do let me know where my mistakes are. Thank you.

Best Answer

Try this:
syms a b
eqn_1 = 20*log10((1 + ((20/a).^(2*b))).^(1/2))== 0.316;
eqn_2 = 20*log10((1 + ((150/a).^(2*b))).^(1/2))==33;
[a,b] = vpasolve([eqn_1,eqn_2],[a,b])
ANSWER
a =
33.350407439877975992438632838773
b =
2.526670930138947892001693474408
YOUR MISTAKES
1) syms f n should be syms a b
2) To view solution sol.a and sol.b you would get your answer because you received them in the form of struct so. to view struct with fields you just simply add dot in between.
Related Question