ABOUT ME

Kylie Hansen is a current Junior at TFHS with a passion for astrophysics. In the Tech program, she focuses on building her programming skills in Python, MATLAB, and LaTeX. 

Kylie and her brother, Kayson, have qualified for the Intel International Science and Engineering Fair in California, where they will present their research in astrophysics, specifically involving exoplanet transits. The graphs of the data were programmed entirely by Kylie utilizing MATLAB. Kylie enjoys exploring just how much MATLAB can do; her highest moments are when she solves a problem in her code by discovering something new, or implementing a more efficient strategy. 

PROJECTS

Code Samples

MATLAB: Plotting Data of Multiple Graphs on One Figure

subplot(2,1,1)
plot(xdata_XO2,ydata_XO2,'ok')
hold on
plot(xdata_XO2,movmean(ydata_XO2,12))
title('March 26: XO-2')
xlabel('UTC hours')
ylabel('Magnitude')
err = (.006*11)*ones(size(xdata_XO2));
errorbar(xdata_XO2,ydata_XO2,err,'o')

subplot(2,1,2)
plot(xdata_XO6,ydata_XO6,'or')
hold on
plot(xdata_XO6,movmean(ydata_XO6,12))
title('March 26: XO-6')
xlabel('UTC hours')
ylabel('Magnitude')

MATLAB: Getting Data from a Previously Established Graph

%Open the file
open('Exoplanet_Transit_Project/XO2_XO6.fig')
%h = handle; get a handle on the file, so that it can be manipulated
h = gcf;
%From h, get children (axes objects) and assign them to axesObjs
axesObjs = get(h, 'Children');
%From axesObjs, get children (data info) and assign them to dataObjs
dataObjs1 = axesObjs(1).Children;
dataObjs2 = axesObjs(2).Children;
%From dataObjs, get the data within the info
xdata_XO6 = get(dataObjs1(2), 'XData');
ydata_XO6 = get(dataObjs1(2), 'YData');
xdata_XO2 = get(dataObjs2(2), 'XData');
ydata_XO2 = get(dataObjs2(2), 'YData');

MATLAB: Creating a Line of Best Fit (2 Ways!)

%Use lsline
lsline
%OR Use polyfit to obtain values of slope and y-intercept
coord = polyfit(x1,y1,1);
%linspace creates a matrix of values
x = linspace(min(x1),max(x1));
y = coord(1)*x + coord(2);
%Plotting the new values creates a line
plot(x,y)

MATLAB: Other Useful Tips and Tricks

%Assigning a variable to a workspace from a function
assignin('base', 'name' , variable)
%Error bars on data in graph
err = 5*ones(size(y));
errorbar(x,y,err,'o')
%Labeling points on a graph
labelpoints(x,y,'name','SE',0.15,1,'Color','r')
%Deleting/Changing an element with a certain value in a vector
element(element==1) = [];
element(element==1) = 2;