Solve equations stored in variables

3 vues (au cours des 30 derniers jours)
Rishabh Agrawal
Rishabh Agrawal le 27 Déc 2020
I have a code in which after the processing a numeric expression is stored in a variable 'Final'
and the numeric expression is (3206987*2^(3/10)*3^(29/40)*5^(23/40))/12000000
but when I do, disp(Final) it shows the entire numeric expression "(3206987*2^(3/10)*3^(29/40)*5^(23/40))/12000000" instead of solving this and printing out "1.841"
How do I get matlab to print out the solved solution instead of the numeric expression?
  1 commentaire
Rishabh Agrawal
Rishabh Agrawal le 27 Déc 2020
% This is the code, Normally "S" will be an input function.
close all
clc
clear
syms w h
S = 0.1901*(w^(0.425))*(h^0.725);
Dsw = diff(S, w);
Dsh = diff(S, h);
first_term = Dsw*10;
second_term = Dsh*2.3;
Final1 = subs(first_term + second_term, w, 100);
Final = subs(Final1, h, 60);
disp(simplify(Final))

Connectez-vous pour commenter.

Réponse acceptée

KALYAN ACHARJYA
KALYAN ACHARJYA le 27 Déc 2020
Modifié(e) : KALYAN ACHARJYA le 27 Déc 2020
disp(vpa(simplify(Final)))
Or
fprintf('%.3f',simplify(Final))
  1 commentaire
Rishabh Agrawal
Rishabh Agrawal le 27 Déc 2020
Thanks It worked

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Symbolic Math Toolbox dans Help Center et File Exchange

Produits


Version

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by