Hello, if i have two equations 1)2x+2 and 2)3x^2+ 4x-7 is there a way to remove the x in a new equation where i am left with 1)2+2 2)3^2+4-7? i would hope it would work with any equation with x in
1 visualizzazione (ultimi 30 giorni)
Mostra commenti meno recenti
Hello, if i have two equations 1)2x+2 and 2)3x^2+ 4x-7 is there a way to remove the x in a new equation where i am left with 1)2+2 2)3^2+4-7? i would hope it would work with any equation with x in
2 Commenti
Risposte (1)
Walter Roberson
il 24 Apr 2020
syms x
eqn2 = 3*x^2 + 4*x - 7
subs(eqn2, x, 1)
Or numerically instead of symbolically:
eqn2 = @(x) 3*x.^2 + 4*x - 7;
eqn2(1)
14 Commenti
Walter Roberson
il 26 Apr 2020
The '' are not part of eqn1_new, they are decoration that MATLAB adds when you display a variable by just giving the name of the variable. disp() is not changing the value, it is just not adding the decoration as it displays the data.
Because of this, although you could
p = evalc('disp(eqn1_new)');
to in some sense capture the display without the '', then as soon as you went to display p just by mentioning its name, MATLAB would add the '' decoration to that -- and you would also have accidentally captured the newline that disp() added. You are no further ahead than if you had just done
p = eqn1_new;
Do not confuse the content of eqn1_new with the decoration that MATLAB adds when displaying it.
Vedere anche
Categorie
Scopri di più su Number Theory in Help Center e File Exchange
Prodotti
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!