Q1: On problem 3.3 for dataset4a and 4b, I am having problems. Do you want us to graph it using the pcolor(squeeze....) that you used below an then just pick two graphs for each dataset so that we get the required 4 graphs? If I try just to graph the dataset using the surf command or the pcolor then I get an error saying matrix dimensions do not match, mesh not rendering. I don't know how to fix that.
Q2: On problem 3.4 I am able to get a custom color and I am able to produce the black and red graph that you showed us in class, but I am not able to get a range of colors or the custom color onto the graph of the data, it only shows up in the black and red. Is this good enough, or do you have a hint for me as to how i can fix this?
Q3: On the filter problem, the low pass looks like a line or a slight 's' curve depending on the window, is this what it is supposed to look like? and I get the same thing when i do this for the high pass. At the end of the loop in the code you gave us, I subtracted the lowpass from the data, but I am still getting the same graph.
Q4: O I'm trying to get matlab working remotely using cygwin on a windows Vista business laptop. I can get Matlab working, but it gives me this message when I start it:
Warning: Unable to open display , MATLAB is starting without a display. You will not be able to display graphics on the screen. Warning: MATLAB is starting without a display, using internal event queue. You will not be able to display graphics on the screen. |
Q6: For the header, what are the inputs and outputs? Input: datasets, Output:
visualizations?
Q8: I can't get matlab to plot two different colormaps in one figure. How can I fix this?
Q11: What are the tic and toc functions and how do I implement them and get them to work in my program?
A1: Remember that pcolor can only plot 2d matrices. The data in 4a and 4b are 3d matrices, so you need to choose 2 dimensions for each plot which show the relevant data, and plot those. If you choose the correct 2 dimensions (use some intuition of perhaps, hint hint, SIZE of the dimensions) you will see in the plot what is correct (ie the image for 4b will make sense, 4a shouldn't be the criterion of which dimensions to choose).
A2:To get a custom color, you can just take the example I gave, and make more rows in between - 0:1 is replaced by 0:0.01:1. You can create other colors by other combinations of color components, like have blue go from 1 down to zero (make the step negative 0.1), while red goes up, or similar. Make something that you think looks interesting - to the point that you understand how to control the colormap, since that's the point of this exercise.
A3: What you get depends on what filter strength you use. The wider the window, the more strong the filter strength, and if you make a very strong filter you'll filter everything out (a straight line). For the high pass, make sure you return the new variable - ie if you now do xhp=x-xf, make sure that the variable returned by the filter function is xhp, not xf, or just go like the following:
xf=x-xf;
A4: ...follow the directions, then launch x11 by finding and double clicking the file startxwin.bat. An x-terminal will come up (a text only display) from there, follow the rest of the steps here to ssh into a server and launch matlab...
• Login as above from an x11 terminal program, but when performing the ssh command, change to ssh icogsci1.ucsd.edu -X -l yourusernamefortheclassbutnotpassword
• then type return
• when prompted, type your password, then return
• press space when prompted
• then at the command prompt type matlab
• matlab will start (it takes a while, depending on your network speed) and you will see the interface used in class. You can use your mouse, but it will be slower since it is running over the network.
• when done with matlab, quit matlab normally as you would any other program
• then type logout at the command prompt for the x-terminal
did you do the startxwin.bat command?
A5: Did you check the size of each variable? If they are the same size you should be able to add them.
A6:That's reasonable. There is some flexibility here, but consider when creating a header, "What is going in to the program? What is coming out of the program?" Think of it as this - if some stranger picks up your code, they should be able to read the header quickly and know what it does generally, what it needs and what happens as a result of running it.
A7:Yes the comments should be generally grouped with the images, or should refer to the figure numbers - but try to keep the figures close to the actual text. I suggest using word or another word processor rather than hand-writing if possible, or if hand-written, it should be well formatted and clearly written. Think of this as a formal report of results that you are communicating to somebody who you want to see your paper as professional.
A8: Matlab has issues with plotting two different colormaps in the same figure. There are fixes for this, but for now just create two figures and put them together in your word processor (like microsoft word).
A9: Choose the most meaningful dimensions for 4a and b (the meaningful dimensions of one are the same dimensions to use as on the other, though the data is different), and make one plot of 4a and two of 4b (each of 4b with a different colormap), and then do the part of adding A+B, and here is where you use a custom colormap.
so
1 plot of 4a
2 plots of 4b using different build-in colormaps
1 plot of A+B using a custom colormap
don't forget the comments please.
A10: You can use the low pass filter code from the handouts page directly by downloading it, then you will call it from your mfile. The high pass filtering code is almost the same as the low pass filtering code, with one additional line, so you can resave the low pass filter mfile as High_Pass.m, then rename the function, and add the equation discussed in class in the second filtering lecture (where we talk about high pass filtering) to the last line. Now the key is to realize you need to call the function, not run that m-file. So you would have another m-file for your homework, and in that file, have something like
filt_dat = High_Pass(y,10);
and then plot that on the same figure as the unfiltered data, with a different color and linetype, and you'll have your high pass filtered data.
A11:Tic and toc are timer functions, and what you do is place tic where you want to start timing, and toc where you want to stop. Then you'll get, at the command window, a measure of time to execute that code
A12: Custom line and color types are done in the following way - plot(x,y,' r-- ' ) will create a dashed red line. Similar with the other linetypes and colors
A13:Legends are used generally when there's more than one plot line in a figure. So that's when you'd need it. it works like the matlab help documentation: legend('this will describe plot 1','this will describe plot 2') if you wanted to make a legend for 2 plots. See matlab help for more info, let me know if you need more explanation.