Matlab不会在格式短后缩短答案 [英] Matlab wont shorten answer after format short

查看:68
本文介绍了Matlab不会在格式短后缩短答案的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用matlab将答案简化为科学计数法,但它会继续显示较长的数字.

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

这是我的matlab脚本:

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)

这是matlab给我的结果:

This is the result matlab gave me:

Il_per_area =

Il_per_area =

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

有人可以帮我吗

推荐答案

这就是Matlab处理符号表达式的方式.您可以尝试替换E的值

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

subs(Il_per_area, 3.2)

或者更确切地说,您希望在答案中看到带有符号E的较短参数:

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

添加一行可变精度算术(VPA)

vpa(Il_per_area,4)

答案是

ans =

2.223e55*exp(1.985*E)*(3.942*E^2 - 3.971*E + 2.0)

这篇关于Matlab不会在格式短后缩短答案的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆