Ahmadinejad fries up a fresh batch of hate; denounces Paul the Octopus

July 28th, 2010 by Sunny Man No comments »

You would be forgiven for thinking you were reading a copy of The Onion, or something like that, when you read that Iranian President Mahmoud Ahmadinejad took precious time out of his obviously busy and hectic schedule to denounce Paul the Octopus – the very same inky cephalopod that correctly predicted the outcome of all of Germany’s seven World Cup games this year – as a symbol of all that is wrong with the West. The wacky West-hater went as far as to accuse Paul of spreading ‘western propaganda and superstition’.

As a scientist, I think Ahmadinejad has a point buried somewhere deep beneath all that shit he chats. As modern, scientific and progressive nations we shouldn’t be advertising the belief that a sea creature can predict the future. That’s an absurd conclusion to come to. I think what the Iranian president was trying to say is that our belief in luck and believing that we can predict the future is totally unfounded. Yeah, that’s what he was trying to say.

Instead, we obviously should be punishing rape victims, segregating the population by gender because of those insatiable females who can’t control themselves and whom try to corrupt the men. We should be spending money on ‘nuclear power’, or another word is defiance, rather than letting girls learn to read and write and we should definitely be helping out those poor, poor terrorists because they’re just misunderstood and only need a few more missiles to get people to come around to their way of thinking. It all makes sense really.

Mahmoud, to put it in the politest possible words, you are a pillock. You say you and your country aspire to ‘human perfection’ and that we couldn’t possibly do the same because we cheer on a slimy sea creature because it, by chance, happens to choose to eat from one box which we happen to assign to a football team. We know it can’t predict the future. If you want to heckle and denounce something worth your while, and do something honestly decent with your power, stature and your precious time why not speak out against the belief in witchcraft in some African nations that harms children? Or work to help abolish the death penalty in Saudi Arabia for the ludicrous crime of sorcery, for which there is no legal definition.

Why? Simple, you’re a stroppy teenager rebelling against his parents, doing the things they tell you you’re not allowed to do. Pillock.

3D Hill Plot with MATLAB

July 27th, 2010 by Sunny Man No comments »

I thought I’d share some of the easier things I had to do as part of the first year of my course. One of those tasks was to generate a 3D plot of a function and then also plot 2D cross sections at different values.

We start off with a mathematical function that describes, what we will call, our hill. This function represents the ‘height’ of our hill, h if you will, at the different points in x and y.

exp(-(x.^2)-(y.^2)) + 0.5.*exp(-((x-2).^2)-(y.^2));

So, in our MATLAB script we first of all generate a grid of points using x values from -1.5 to 3.5 and y values from -2 to 2. The follow code achieves this.

x = linspace(-1.5,3.5,50); % 50 values of x
y = linspace(-2,2,25); % 25 values of x
[xg yg] = meshgrid(x,y); % generate points

And next we generate the height values of our hill, using the grid we have just created with x -> xg and y ->yg.

h = exp(-(xg.^2)-(yg.^2)) + 0.5.*exp(-((xg-2).^2)-(yg.^2)); % calculate height values

With our hight values in the array h, all we need to do now is plot them. Firstly, to create the 3D plot we just plot x,y and h using the surf() function.

figure(1); % create new figure window
surf(x,y,h); % surface plot
title('3D Hill Plot'); % title and axis labels
xlabel('x');
ylabel('y');
zlabel('height');

Now, to look at several slices through the hill at different values of y, we need to select the different values of y from its array and plot them on the same graph.

figure(2);
plot(x,h([1,10,20],:)); % plot 1st, 10th and 20th values of y
title('2D Hill Plot'); % title and axis labels
xlabel('x');
ylabel('height');
legend('y = -1.5','y = -0.4','y = 1.2',0); % legend not overlapping any of the plot

Putting it all together you get a 3D plot of the function and the cross sections in two windows. Job done.

Hold Your Desire: New HTC Desire

July 26th, 2010 by Sunny Man No comments »

I was planning to upgrade my phone in the next few weeks, as I have mentioned before, to one of the best all round smartphones on the market, the HTC Desire. If you go to any review site you can find the HTC Desire near the top of the best phones list, if not occupying the top spot.

One item of contention with the Desire is that the battery life is rather disappointing. While this doesn’t deter me, as I’m used to charging my current phone nearly every day, it would deter some power users looking for something more. With this in mind, HTC today put out a press release detailing that the next revision of the HTC Desire, and the global Nexus One (the Google phone), would include a new screen employing Super LCD display (SLCD) technology which offers up to 5 times more power efficiency than the current lineup.

Whilst this is indeed good news, it also means users wanting to upgrade to the HTC Desire have to choose between risking upgrading now for the phone that everyone loves, or waiting until whenever it is HTC decides to unleash the more power efficient SLCD Desire onto the market, which may be as soon as the end of this summer. Or even to wait for the rumoured HTC Desire HD, hitting a shop near you in October apparently.

Create Fractals with MATLAB

July 26th, 2010 by Sunny Man No comments »

As part of my University course we had to use the scientific MATLAB programming language, and computing environment,  for several tasks in the first year. While the set tasks were as drab and dreary as you would expect from a Physics course, it taught us the basic skills and the problem solving skills key to the course.

In my spare time I ported a PHP script my friend created to MATLAB which enables the creation of beautiful fractals from the Mandlebrot set. The maximum image size you can create depends on the amount of memory available in your system and the script isn’t something I’ve spent a lot of time on so feel free to improve on it.

On my laptop, a 10,000 x 10,000 pixel image took about an hour to create, using 20 iterations. You may find this differs on other machines.


Download the MATLAB Fractal Generator Code.