3
$\begingroup$

I have got some frequency response data from a speaker measured with different incident angles between speaker and microphone taken in an anechoic chamber. The data can be found here.

The whole experiment consists of measurement series at 5 different angles which are {0°, 30°, 60°, 90°, 180°}

plot of measurement series

I individually import (and save them in a variable) with:

 importlist[path_] := 
 ToExpression @ Partition[Flatten @ Drop[Import[path, "Words"] , 2], 2]

and process them (downsampling and rearranging) with the following functions to get a list suitable for ListDensityPlot

downsampleFunction[list_, n_, pos_] := 
Downsample[pos @ Transpose @ list, n]

combineFunction[list_, angle_, downsampleBy_] := 
Thread[{downsampleFunction[list, downsampleBy, First], angle, 
downsampleFunction[list, downsampleBy, Last] }] 

listcombineFunction[listoflists_, listofangles_, downsampleBy_] := 
Flatten[Table[
combineFunction[listoflists[[i]], listofangles[[i]], 
downsampleBy ], {i, 1, Length@listoflists}], 1]

If now plotted with something like

ListDensityPlot[
listcombineFunction[
{list0FR, list30FR, list60FR, list90FR, list180FR}, 
{0°, 30°, 60°, 90°, 180°}, 1000]]

I get a nice looking plot but in linear scale. Since this is frequency response data (and I would like to show that directivity is a matter that becomes (more) relevant at higher frequencies) I would rather prefer a logarithmic frequency (horizontal) axis.

If I change my processing functions by adding a Log10@ in front of my frequency range data like done here:

combineFunction2[list_, angle_, downsampleBy_] := 
Thread[{Log10 @ downsampleFunction[list, downsampleBy, First], angle, 
downsampleFunction[list, downsampleBy, Last] }] 

listcombineFunction2[listoflists_, listofangles_, downsampleBy_] := 
Flatten[Table[
combineFunction2[listoflists[[i]], listofangles[[i]], 
downsampleBy ], {i, 1, Length@listoflists}], 1]

and plot the results I get a ugly graphics glitch (I guess some interpolation issue due to the accelerated changes forced by the logarithm?). An example with corrected ticks and different styling options:

example image

P.S.: I noticed another glitch concerning the 45° rotated frame labels. Does anybody know a fix for the behaviour? If I try the same code with another example the font looks somewhat thinner but not as aliased as in the sample picture above. Example for "desired" behaviour:

 LogLinearPlot[Log10[x], {x, 1, 1000}, 
 FrameTicks -> {Flatten[
 Table[{d 10^e, Rotate[d 10^e, 45 Degree]}, {e, Floor[Log[10, 35]],
 Ceiling[Log[10, 22000]]}, {d, 1, 5, 1}], 1], Automatic}, 
 Frame -> True, ImageSize -> 600]
$\endgroup$
3
  • $\begingroup$ FileNuke is annoying me. What do I have to click to start the actual download? $\endgroup$
    – Mr.Wizard
    Commented Apr 24, 2013 at 13:20
  • 1
    $\begingroup$ 1-click-hoster aren't what they were used to be anymore... until I find another one that actually works you can try dl.dropboxusercontent.com/u/74966785/SaschaData.zip $\endgroup$
    – Sascha
    Commented Apr 24, 2013 at 13:38
  • $\begingroup$ Added another download link that hopefully does the trick. $\endgroup$
    – Sascha
    Commented Apr 24, 2013 at 14:27

1 Answer 1

2
$\begingroup$

Adding ClippingStyle -> Automatic as option to ListDensityPlot fixes the issue - as simple as that - don't know why I didn't see that before. Still leaves the strangely aliased font when turning the frame ticks at an 45° angle. I found out that when exporting the cell as .eps the font looks "normal" (just a bit thinner) in third party software (at least in Indesign).

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.