Archive for the ‘Tutorials’ category

Student Advice: Managing Your Money

August 14th, 2010

Reluctantly sliding on into my third year of my university course this September, I thought it wise to share some of my experiences with managing money as a student who has been living in halls for one year and privately rented accommodation for the other. Some of us are lucky in that our parents moonlight as an infinite supply of money, but for those who don’t have that luxury we have to manage our money like responsible adults. Bummer, I know.

Not managing our money properly can lead to terrible decisions that have to be made; Do you buy the food for the week or the cheap beer that’s only on offer today? Do you pay your rent or go out every night in a week? As you’re a student, and because you’re reading this article, you’ve obviously gone weeks without eating and been behind on your rent. On a serious note, this can not only effect your health, well being and state of mind, but also result in you becoming homeless or having legal action taken against you. Not what you want at any point during your university life.

In my experience, living in halls on your campus or private halls elsewhere is the easy option. Payments are, usually, in tune with student loan payments and bills and utility payments are usually included in the price. Your first year is usually one crazy year and one you’ll want to cram lots into. For this you need money. Halls is definitely the way to go here.

A few simple things you can do though, to make the most of your first year and prepare for the second. Firstly, if you do receive a student loan and maintenance grants, put them into a high interest savings account. This will hopefully provide you with a few extra quid through interest. Most student accounts require you to use that current account as your main account, and they do check. So have the funds sent to that account and then transfer them to your high interest savings account. Secondly, set aside a certain amount that you will transfer from your current account to a savings account. This is the easy part, but leaving that fund alone will be the hard part. Usually, opening an e-ISA or other savings account is usually free, requiring an initial £1 deposit but this may vary. Basically, it’s easy so there’s no excuse.

When it comes to your second year at university, you’re probably going to move into privately rented accommodation with your mates. That was my decision, anyway. When you do, do your research. What is the normal weekly cost in your area? What length are the tenancies? Will you get a summer concession during the summer months when you’re probably not even going to be living in the house? There are a few things to consider that your SU can probably help you with. Moving into a house, or flat, is a more complicated experience. Firstly, try and go through websites such as Unipol which will hopefully keep the nasty, evil landlords from your computer screen. See the properties. Ask them about the things listed above. And most of all, ask how you’ll be paying. Some like to be paid monthly, or in instalments. Work out when the money will leave your account, and when any money will be entering it from loans or jobs etc. You don’t want to fall behind on payments; although many landlords are quite forgiving, some are not and missing a single payment, even by a day, can be a breach of contract which can lead to eviction.

A top tip for living privately is to plan how much you have to spend over each period between rent payments. Don’t spend more than you have. It’s not worth the hassle.

Other things you can do to help include getting the best phone contract you can, so downgrading to a cheaper tariff, only turning the heating on in your house for a few hours a day. Those sorts of things go a long way. Not getting Sky, Virgin Media or BT, but sticking to Freeview or better yet, just using your laptops/computers to watch your favourite programs. Looking for the best internet deal for your property and not just sticking to the provider that the previous tenants had. And, don’t use your overdraft if you don’t have to.

So, what have we learnt?

Well, if you’re a student you probably didn’t read all of that. So, here are Sunny Man’s top student finance tips to help you have a money trouble free year at university:

  • Transfer your loans/grants into a high interest savings account.
  • Put aside £5/£10 a week into a savings account over the year.
  • Know when and what you have to pay and to who.
  • Try not to use your overdraft, however good it looks.
  • Have fun, it’ll be the best years of your life so far…

3D Hill Plot with MATLAB

July 27th, 2010

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

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.

plot(x,h([1,10,20],:)); % plot 1st, 10th and 20th values of y
title('2D Hill Plot'); % title and axis labels
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.

Create Fractals with MATLAB

July 26th, 2010

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.

PHP Lesson 8

February 14th, 2007

Sunny Man’s TutorialsMy lessons are now into their second week and we’ve still got a way to go yet. This week we will be looking into IF and WHILE statements, $_GET, $_POST and we’ll also look into arrays near the end of the week.

Yesterday we did a simple lesson on $_GET and how to get values from a URL. Today another simple lesson on $_POST and the confusion that comes with it. I introduced you to $_POST in last Friday’s big special and today we are going into much more detail.

Lesson 8: $_POST and Forms

As I showed in Friday’s round up, we use $_POST to collect the values of submitted form data. Some confusion that I had for a while was whether or not to use the name or id attribute in the form fields to let $_POST work. I’ll settle this now – for $_POST to collect the data from the form fields, you need to assign a name attribute to them. The id can be used for labels, CSS classes and other things. Here’s a sample form form.php:

<form action="process.php" method="post">
First Name: <input type="text" name="fname" size="25" />
Last Name: <input type="text" name="lname" size="25" />
Over 16? <input type="radio" name="age" value="1" /> Yes <input type="radio" name="age" value="0" /> No
<input type="submit" value="submit form" />

In the above form we would get 3 values returned through $_POST. These would be the first name, last name and over 16 values. Here’s how we’d capture these values. This file would be process.php, as determined in the form’s first line:

$fname = $_POST['fname'];
$lname = $_POST['lname'];
$age = $_POST['age']; //either 1 or 0

$name = $fname." ".$lname; //stitch the first and last names together

Pretty simple to get the form fields’ values. On Friday we are going to combine everything and a lot of form fields to create a signup form which will include this, arrays and a bit of validation.