Problems with symbolic representation

4 visualizzazioni (ultimi 30 giorni)
Hi everyone!
I'm currently working on a problem, but I'll simplify it so that everyone can know what I mean.
This is the file:
----------------------------------------------------------------------
close all
clear all
clc
syms x
a=5;
b=7;
c=a+b;
solve('x/2*a-7*b-13*c+14*a*b*x*c-34*x-7*b')
----------------------------------------------------------------------
Result:
ans =
(28*b + 26*c)/(a + 28*a*b*c - 68)
How can I get the value of "x" in a normal number, not symbolic expression?
Also
If I use:
eval('x/2*a-7*b-13*c+14*a*b*x*c-34*x-7*b')
I get this:
ans =
(11697*x)/2 - 254
All I need is to get the value of x....
Thanks in Advance!

Risposta accettata

Oleg Komarov
Oleg Komarov il 14 Mag 2012
a = 5;
b = 7;
c = a+b;
syms x
out = solve(x/2*a-7*b-13*c+14*a*b*x*c-34*x-7*b,x)
double(out)
Note that I did not use the ' '.

Più risposte (1)

Walter Roberson
Walter Roberson il 14 Mag 2012
double(solve(subs(sym('x/2*a-7*b-13*c+14*a*b*x*c-34*x-7*b'))))
or
double(solve(x/2*a-7*b-13*c+14*a*b*x*c-34*x-7*b))

Tag

Prodotti

Community Treasure Hunt

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

Start Hunting!

Translated by