问题描述
- Matlab 变量值直接输出 和 sprintf输出 不同是怎么回事?
-
nitao=2.175; nitae=2.18; derta33=30.3; derta13=5.7; L=0.1;%m lamda0=0.633*10^(-6);%m Vm=100;%v e=43; A=10^(-3);%m^2 dertaf=10^7;%Hz syms Ez; E=solve(2*pi*L/lamda0*((nitao-nitae)+Ez*(nitae^3*derta33-nitao^3*derta13)/2)==pi,Ez); E sprintf('半波电场强度:%e','E') Vpi=E*L; dertaph=Vm*pi/Vpi; dertaph sprintf('相位延迟:%e','dertaph') P=e*A*Vpi^2*dertaph^2*dertaf/(pi*L); P sprintf('驱动功率%e','P')
结果:
E =(9444732965739290427392*pi)/1196549586897533007794808436155 + 11258999068427/287405211048345088
ans =
半波电场强度:6.900000e+01
dertaph =
(100*pi)/((4722366482869645213696*pi)/5982747934487665038974042180775 + 11258999068427/2874052110483450880)
ans =
相位延迟:1.000000e+02相位延迟:1.010000e+02相位延迟:1.140000e+02相位延迟:1.160000e+02相位延迟:9.700000e+01相位延迟:1.120000e+02相位延迟:1.040000e+02
P =
43000000000*pi
ans =
驱动功率8.000000e+01
为什么变量值和sprintf的值不一样?
为什么相位延迟有这么多个?
解决方案
解决了。。
我自问自答吧[侧目]
是酱紫:
syms Ez;
E=solve(2*pi*L/lamda0*((nitao-nitae)+Ez*(nitae^3*derta33-nitao^3*derta13)/2)==pi,Ez);
E
sprintf('半波电场强度:%e',double(E))
Vpi=E*L;
dertaph=Vm*pi/Vpi;
dertaph
sprintf('相位延迟:%e',double(dertaph))
P=e*A*Vpi^2*dertaph^2*dertaf/(pi*L);
P
sprintf('驱动功率%e',double(P))
就得到:
E =
(9444732965739290427392*pi)/1196549586897533007794808436155 + 11258999068427/287405211048345088
ans =
半波电场强度:3.919945e-05
dertaph =
(100*pi)/((4722366482869645213696*pi)/5982747934487665038974042180775 + 11258999068427/2874052110483450880)
ans =
相位延迟:8.014380e+07
P =
43000000000*pi
ans =
驱动功率1.350885e+11
是符合的
时间: 2024-10-03 22:48:38