How do I output a scientific (exponential) number multiplied by a symbol.

1 view (last 30 days)
Hello
I'm writing a code which involves partial differentiation and integration with symbols. The problem is that the code outputs the number as a fraction which includes a huge numerator and an even bigger denominator. Is there a way to out put it as an exponential for example 5.56E-6? And if possible is there a way to show more significant figures.
The I1, I8 are the outputs.
%Castigliano With Respect to R1x %Clear command window and variables clearvars; clc; %Stating the knowns x1=0.01336; x2=0.01871; x3=0.02405; syms R1x R2x Fx1 Fx2 x
%First Moment M1 = R1x * x disp('dM1/dR1_x: '); k=diff(M1,R1x); disp(k) I1 = int( M1 * diff(M1,R1x), x, 0, x1)
%Eighth Moment M8 = R1x*(3*x1+2*x2+x3)-Fx1*(x3/2+x2+2*x1)+R2x*(x1)+(R1x-Fx1+R2x)*x disp('dM8/dR1_x: '); k=diff(M8,R1x); disp(k) I8 = int( M8 * diff(M8,R1x), x, 0, x2)

Answers (1)

Mischa Kim
Mischa Kim on 24 Nov 2014
Karim, have you tried
vpa(I8)
or
vpa(I8, 4) % showing 4 significant digits
  1 Comment
Karim Taha
Karim Taha on 24 Nov 2014
Wow.. Finally! Well this solved the bigger part of the problem. It now shows the decimals correctly. If it can show the final answer exponentially that would be perfect!
For example: Instead of 0.000983182, 9.83182x10^-4 or 9.83182E-4

Sign in to comment.

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!