Solve a matrix-form equation

3 views (last 30 days)
Homayoon
Homayoon on 26 Jun 2015
Commented: Homayoon on 26 Jun 2015
Dear All,
I have a matrix of constants that gives me the constants for my equation. I need to know how to solve that equation in MATLAB. Assume the following is my matrix of constants :
Constants= [ 0.05888460 1.325 1
-0.06136111 1.87 1
-0.002650473 2.5 2
0.002731125 2.8 2
0.001802374 2.938 2.42
-0.001150707 3.14 2.63
0.00009588528 3.37 3
-0.000000110904 3.75 4
0.0000000001264403 4 5];
and the equation comes from the following sum:
Sum=1;
for i=1:9
Sum= Sum + (Constants(i,1) * ((100/333)^( Constants(i,2))) * ((x)^(Constants(i,3))));
end
basically the equation I want to solve is :
eqn = Sum == 1.0259;
solx = solve(eqn, x)
I do not know why I could not use
syms x
command to define an equation! Please help, I appreciate your attention! Best

Accepted Answer

Azzi Abdelmalek
Azzi Abdelmalek on 26 Jun 2015
s=sum(Constants(:,1) .* (100/333).^Constants(:,2) .* x.^Constants(:,3) )
sol=solve(s)
  2 Comments
Homayoon
Homayoon on 26 Jun 2015
it gives me an error! undefined variable x!
Homayoon
Homayoon on 26 Jun 2015
i fix it! thanks

Sign in to comment.

More Answers (0)

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!