NaN problem with graphing
3 次查看(过去 30 天)
显示 更早的评论
I am trying to graph Zf vs f for f:(10^6 to 10^10):
if true
format long
a = 1
b = 3*10.^-7
c = 5*10.^-8
f0 = 4*10.^9
sigma = 0.2
t0 = 0
tmax = 2*b
t = linspace(t0, tmax)
omega = 2*pi*f
omega0 = 2*pi*f0
yt = a*exp((-(t-b).^2)/((2*c).^2))
figure(1)
plot(t,yt)
zt = yt.*(1-((sigma/2)*(1-sin(omega0*t))))
figure(2)
plot(t,zt)
f = linspace(10.^6, 10.^10)
G = -2.*pi.*f.*(pi.*c.^2.*f + sqrt(-1).*b)
D = (((b-(sqrt(-1)).*2.*pi.*c.^2.*f-t0)/(sqrt(2).*c)))
E = (((b-(sqrt(-1)).*2.*pi.*c.^2.*f-tmax)/(sqrt(2).*c)))
Ff = sqrt(pi/2).*a.*c.*exp(G).*((-sqrt(-1).*(erfi(-sqrt(-1).*D)))-((-sqrt(-1).*(erfi(-sqrt(-1).*E)))))
Zf = ((1-(sigma/2)).*Ff) + (sqrt(-1).*sqrt(pi/2).*((a.*c.*sigma)/4).*exp(-((2.*pi.*f+omega0).*(c.^2.*(2.*pi.*f+omega0)+2.*sqrt(-1).*b)))).*(-exp(4.*pi.*c.^2.*f.*omega0+2.*sqrt(-1).*b.*omega0).*((-sqrt(-1).*erfi(((tmax-b+sqrt(-1).*c.^2).*(2.*pi.*f-omega0))/(sqrt(2).*c)))-(-sqrt(-1).*erfi(((t0-b+sqrt(-1).*c.^2).*(2.*pi.*f-omega0))/(sqrt(2).*c))))+(-sqrt(-1).*(erfi(((tmax-b+sqrt(-1)*c.^2).*(2.*pi.*f+omega0))/(sqrt(-1).*c))))-(-sqrt(-1).*erfi(((t0-b+sqrt(-1).*c.^2).*(2.*pi.*f+omega0))/(sqrt(-1).*c))))
figure(3)
plot(f,Zf)
% code
end
Why am I getting that both Ff and Zf are not a number for this evaluation? I've solved for Ff and it comes out to 0 (or at least really close to 0 and so the display was 0 when I solved for it). That wouldn't necessarily make Zf turn out 0 as well though since Ff is only multiplied against the first part in the equation Zf.
3 个评论
回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Calculus 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!