Orbital velocity of the cloud
This lab, very similar to Lab 3, requires you to 1) load .dat files to MATLAB and make plots, 2) use ginput to pull out some info from your plot, and 3) use MATLAB as a calculator to get some science ideas.
Let's load the data first:
lon17 = load( ... );
The first column in lon17 is the frequency channels used in the observation, and the second column is the relative strength of the H-alpha line. Let's take a look on this spectrum:
figure(1); clf; plot( ... ); ...
Remember, the smallest frequency represents the largest redshift, which gives us the tangent velocity. Recall your knowledge about ginput:
[freq(1), bt(1)] = ginput(1);
By doing this, you can build up an array of frequencies (freq) using freq(1), freq(2), etc, increasing the number as you go through the files. Do NOT increase the number in parentheses after ginput: the 1 there is telling ginput that you only want one point, so that ginput doesn't wait for you to click on more points. If you would like more information on ginput, refer to the tutorial page from Lab 3.
You can also save the array so you have a record of them:
save freq.mat freq
which will save the variable freq in the file freq.mat, exactly as you had it stored in your workspace (make sure you include the .mat ending on the filename). That way, you can continue your unfinished work anytime by loading the .mat file:
You should hand in a hard copy of your frequencies. To do this, subtract off 1400 from the value, so that MATLAB shows enough significant figures.
freq - 1400 % for DISPLAY PURPOSES ONLY, in MHz
You can either copy/paste the output from MATLAB after this command into a blank file (MS Word will do), or publish your code, including a line immediately following the command which contains just two percent signs (%%). The two percent signs will make MATLAB print the results immediately following the calculation. Be sure to note your units! Make sure you use the original values in freq when doing calculations for the rest of the lab! Subtracting 1400 is for DISPLAY PURPOSES ONLY!
Once you have measured the smallest frequency for each of the 13 files, use the redshift equation provided in the handout (and your original values for freq and NOT the freq-1400) to find the tangent velocities:
c = ... ; % in km/s f_rest = ... ; % in MHz vtan = ... ; % in km/s
Now you need to correct for the Sun's motion along the line of sight. First create an array of the Galactic Longitudes corresponding to each of your tangent velocities. Hopefully you went through the files in numerical order, so that your frequency measurements match up with the appropriate Galactic Longitudes...
glon = [17 21 25 ... 65]; % in degrees
Now add the correction for the Sun's line of sight motion to the tangent velocities to get the orbital velocities: (note that you need to convert the longitude from degrees to radians when using it in the sin function!)
vsun = ...; % in km/s vlos = v_sun*sin(...) ; % in km/s vorb = vtan + vlos % in km/s
Make sure you hand in a record of your orbital velocities, either by copy/pasting the output from the command window or by publishing your code (without a semi-colon on the orbital velocity calculation). If you publish your code, add a line after the calculation that is just two percent signs (%%) so that the values print immediately after the command. Whichever method you choose, make sure it is clear what your units are!