1 / 9

More bits and pieces

More bits and pieces. No over arching theme; just stuff that is useful. how to print a figure to a file fprintf handle graphics Read chapter 9 for next class!. But first, where are we going? How do we answer

ull
Download Presentation

More bits and pieces

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. More bits and pieces No over arching theme; just stuff that is useful. how to print a figure to a file fprintf handle graphics Read chapter 9 for next class!

  2. But first, where are we going? • How do we answer • Is the globe warming? So why has it not warmed significantly in the last 10 years? • How can you estimate how fast the globe is warming from data? How fast CO2 is increasing? • How can we show that, for example, winds control coastal ocean temperature, or nutrient levels in soil are related to rainfall rates. • Why is your error estimate in the homework wrong? and how can we make it right?

  3. You have a figure; how to save it to a file? • Why not just use the gui? • print • print %straight to printer • print mypicture.ps • print -dpng -r200 mypicture.png • What format should you use?

  4. how to change properties of something you plot (like the lines in this example)? • handle graphics • plot(x,y,’linewidth’,2) • How do you find the properties? • “doc plot” • The results of doc have many examples, and are much more complete than the “help” pages. They are the manuals online. • see next page

  5. How do you print numbers properly? Imagine you have xmean, and want to print just the significant digits: >> xmean xmean = 1.7725 >> • Well, that is not helpful.

  6. Use fprintf! • Horrible syntax left over from C! >> fprintf('The value of xmean is %4.2f, and xmean^2 is %4.2f\n',xmean,xmean^2) The value of xmean is 1.77, and xmean^2 is 3.14 >> • explain text • explain %4.2f notation • and %4.2e • explain \n

  7. What happens if you don’t include enough %f’s to print an array? >> fprintf(’a big number %5.2f\n',big_huge_array)

  8. On debugging! %Making a histogram and repeating above with 15 sets of random #'s subplot(2,1,2) x=rand([20000,15]); hist(x,-8:0.1:8); xlabel('x') ylabel('# of points') title('bin size 0.1, sum of 15 sets') hold on s1=sum(x,1); mean1=mean(s1); std1=std(s1); max1=mean1+std1; min1=mean1-std1; index1=find((x>=min1)&(x<=max1)); length(index1)/20000

More Related