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

Walter Roberson
Walter Roberson 2015년 8월 5일
Note: erfi() requires the Symbolic Toolkit, or one of the File Exchange contributions that implements erfi(). Although erfi is formally defined in terms of erf, MATLAB's erf does not handle complex values.
Walter Roberson
Walter Roberson 2015년 8월 5일
Your code uses f to define omega before you assign a value to f.
imarquez
imarquez 2015년 8월 6일
I am using the symbolic toolbox. So i moved the definition of f up to right under the definition of t and removed the definition of omega since it wasn't used. I am still getting the NaN solution for all of Zf and all but columns 1 through 2 of Ff. Why would I get a value for the first two columns and nothing after that?
Also is there a way to evaluate the erfi() in imaginary terms?

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

도움말 센터File Exchange에서 Graph and Network Algorithms에 대해 자세히 알아보기

질문:

2015년 8월 5일

댓글:

2015년 8월 6일

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by