sudo vim /etc/network/interfaces

add the following contents

auto wlan0
iface wlan0 inet manual
wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf
iface default inet dhcp
iface aoakley-home inet static
address 192.168.11.21
netmask 255.255.255.0
network 192.168.11.0
broadcast 192.168.11.255
gateway 192.168.11.1
dns-nameservers 192.168.11.1


and then execute

sudo rfkill unblock wifi
sudo iwconfig wlan0 txpower on
sudo shutdown -r now

refer to : http://www.aoakley.com/articles/2013-07-31-raspberry-pi-networking.php