NaN problem with graphing
3 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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 commentaires
Réponses (0)
Voir également
Catégories
En savoir plus sur Calculus dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!