Question

I'm trying to get matlab to shorten the answer into scientific notation but it continues to display long numbers.

Here is my matlab script:

syms E;
kb=8.617e-5; %eV/k
h=4.136e-15; %eV*s
Ts=5760; %k
q=1; %ev
c=3.0e8; %m/s
theta_s=atan(7e8/1.5e11); %rad

format short
Il_per_area = (q*pi/2)*(1-cos(2*theta_s))*int(((2/h^3*c^2)*E^2)/(exp(E/(kb*Ts-1))),E)

This is the result matlab gave me:

Il_per_area =

(52508430427297951419542428146127404493579145286547868195529063488882991519987*exp((2251799813685248*E)/1134143295600563)*((5070602400912917605986812821504*E^2)/1286281014955706024710845916969 - (4503599627370496*E)/1134143295600563 + 2))/2361183241434822606848

Can someone help me.

Était-ce utile?

La solution

That is how Matlab deals with symbolic expressions. You can either try substituting a value of E

subs(Il_per_area, 3.2)

or rather, you'd like to see shorter parameters in the answer with the symbolic E:

add one line of variable-precision arithmetic (VPA)

vpa(Il_per_area,4)

The answer is

ans =

2.223e55*exp(1.985*E)*(3.942*E^2 - 3.971*E + 2.0)
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top