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

조회 수: 4 (최근 30일)
Karim Taha
Karim Taha 2014년 11월 24일
댓글: Karim Taha 2014년 11월 24일
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)

답변 (1개)

Mischa Kim
Mischa Kim 2014년 11월 24일
Karim, have you tried
vpa(I8)
or
vpa(I8, 4) % showing 4 significant digits
  댓글 수: 1
Karim Taha
Karim Taha 2014년 11월 24일
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

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Calculus에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by