Yes, you right!
Do you know how to get Density plots with Julia?
GK
On Thursday, February 5, 2015 at 2:16:37 PM UTC+1, Martin Johansson wrote:
>
> Hi!
>
> You need to add explicit .* between the parentheses (I guess you copied
> the Mathematica code and forgot to add multiplication). That worked for me.
> Also, the (41253 .* l) part came out as 41253 .* "ell" (not "one") when I
> copied it, but that might be a browser problem on my end.
>
> //martin
>
> On Thursday, February 5, 2015 at 12:02:15 PM UTC+1, Giacomo Kresak wrote:
>>
>> *Good morning, *
>>
>> *Would you please give me some lights here: *
>>
>>
>> In [104]:
>>
>> IP(X,Y) = (0.00111111) .* (cos(152.309 .* X - 1324.58 .* Y) + cos(152.309 .*
>> X - 1050.42 .* Y) + cos(152.309 .* X - 776.265 .* Y)
>>
>> + cos(152.309 .* X - 502.11 .* Y) + cos(152.309 .* X - 227.955 .* Y) + 2 .*
>> cos(676.25 .* X) (cos(152.309 .* Y)
>>
>> + cos(426.464 .* Y) + cos(700.619 .* Y) + cos(974.775 .* Y) + cos(1248.93 .*
>> Y)) + 2 .* cos(414.279 .* X) (cos(182.77 .* Y)
>>
>> + cos(456.926 .* Y) + cos(731.081 .* Y) + cos(1005.24 .* Y) + cos(1279.39 .*
>> Y)) + cos(152.309 .* X + 227.955 .* Y)
>>
>> + cos(152.309 .* X + 502.11 .* Y) + cos(152.309 .* X + 776.265 .* Y)
>>
>> + cos(152.309 .* X + 1050.42 .* Y) + cos(152.309 .* X + 1324.58 .* Y)).^2
>>
>> Out[104]: IP (generic function with 1 method)
>>
>>
>> In [105]:
>>
>> fig = figure()
>>
>> X = linspace(-0.90, 0.90, 100)'
>>
>> Y = linspace(-0.90, 0.90, 100)
>>
>> R = sqrt(((1600 .* pi ./(41253 .* l)).^2) .* (X.^2 .+ Y.^2))
>>
>> Z = (2 .* besselj1(R) ./ R).^2 .* IP(X,Y)
>>
>> surf = plot_surface(X, Y, Z, rstride=1, cstride=1, linewidth=0,
>> antialiased=false, cmap="coolwarm")
>>
>> zlim(0,1.0)
>>
>> ax = gca()
>>
>> ax[:zaxis][:set_major_locator](matplotlib[:ticker][:LinearLocator](10))
>>
>> ax[:zaxis][:set_major_formatter](matplotlib[:ticker][:FormatStrFormatter]("%.02f"))
>>
>> fig[:colorbar](surf, shrink=0.5, aspect=5)
>>
>> dimensions must match
>> while loading In[105], in expression starting on line 5
>>
>> in getindex at /Users/gilmoretto/.julia/v0.3/PyCall/src/PyCall.jl:642
>> in pysequence_query at
>> /Users/gilmoretto/.julia/v0.3/PyCall/src/conversions.jl:743
>> in pytype_query at
>> /Users/gilmoretto/.julia/v0.3/PyCall/src/conversions.jl:759
>> in convert at /Users/gilmoretto/.julia/v0.3/PyCall/src/conversions.jl:808
>> in pycall at /Users/gilmoretto/.julia/v0.3/PyCall/src/PyCall.jl:812
>> in fn at /Users/gilmoretto/.julia/v0.3/PyCall/src/conversions.jl:181
>> in close_queued_figs at
>> /Users/gilmoretto/.julia/v0.3/PyPlot/src/PyPlot.jl:295
>>
>>
>> *I was able to plot the besselj1. But when I multiply it to IP(X,Y), I am
>> getting dimension matching issue! *
>>
>> *What am I doing wrong? *
>>
>>
>> *Do you know how to get a Density Plot of *
>>
>>
>> *Z = (2 .* besselj1(R) ./ R).^2 .* IP(X,Y)*
>>
>> ...
>
>