# Plot not working

I am trying to generate a plot for S2[w]. My code is below

L := 50
Umc := 4.31
Su[ω_, σ_, τ_] := (σ^2 *τ/π )*1/(1 \
+ (τ *ω)^2)
Sw[ω_, σ_, τ_] := (σ^2 *τ/(2*π \
))*(1 + 3*(τ* ω)^2)/(1 + (τ*ω)^2)^2

Ru[s_] := InverseFourierTransform[Su[ω, 1, L/Umc], ω, s]

S2 [ω_] := Integrate[Ru[s]*Cos[2*ω*s], {s, 0, Infinity}]

Plot[S2[ω] , {ω, 0, 1}]


I have no idea what I am doing wrong. The function outputs number for the prescribed range when I tested. Your help would be much appreciated. Thanks!

• Change to Plot[Evaluate@S2[\[Omega]], {\[Omega], 0, 1}, PlotRange -> All]
– ciao
Mar 23, 2014 at 0:37

Plot[Evaluate@S2[ω], {ω, 0, 1}, PlotRange -> All] BTW, generally a bad idea to use symbols with capitalized initials - you risk clashing with built-in symbols...

• thanks for the help...if I want to plot another function S3[w] on the same graph then can you please help me with this? I tried Plot[{Evaluate@S2[\[Omega]], Evaluate@S3[\[Omega]]}, {\[Omega], 0, 1}, PlotRange -> All] but it doesn't work. where S3[\[Omega]] = Integrate[Ru[s]*Cos[\[Omega]*s], {s, 0, Infinity}]...also I would like to have the x axis in log scale...can you please help with this? thanks
– Stoc
Mar 23, 2014 at 1:09
• @Stoc Evaluate should be placed at the first level inside the function with a Hold* attribute you wish to cancel (Plot in this case): Plot[Evaluate@{S2[\[Omega]], S3[\[Omega]]}, {\[Omega], 0, 1}, PlotRange -> All]. Mar 23, 2014 at 1:19
• @AlexeyPopkov Thank you so much again....I have yet again one more problem, I am trying to do a LogLog plot and I am using: LogLogPlot[Evaluate@S2[\[Omega]], {\[Omega], 0, 1}] but there is an error...can you please help with this? sorry for the bother
– Stoc
Mar 25, 2014 at 17:20
• @AlexeyPopkov also, if I use your variant above (i.e., LogLogPlot[Evaluate@{S2[\[Omega]], S3[\[Omega]]}, {\[Omega], 0, 1}, PlotRange -> All]) for many plots then will it still work? I'll really appreciate the help...just need this result
– Stoc
Mar 25, 2014 at 17:22
• @Stoc Please read the error messages carefully, they contain key information what you are doing wrong and how to do it right. In the case of LogLogPlot you get the message "Range specification {ω,0,1} is not of the form {x, xmin, xmax} with xmin and xmax positive." which simply means that you must specify the plotting range with positive boundaries because Log is Real only for positive argument. So you should use something like LogLogPlot[Evaluate@S2[\[Omega]], {\[Omega], 0.01, 1}]. Answering your second question, yes, it should work. Mar 25, 2014 at 19:17