hwk2_2011 - MSC321 Homework 2 Due February 11 1 Write a...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: MSC321 Homework 2 Due February 11 1. Write a program that will print out the value of the function defined below at 200 equally spaced set of points for- 10 ≤ x ≤ 10: f ( x ) =                    1 + ( x + 7 . 5)- 8 . 5 ≤ x ≤ - 7 . 5 1- ( x + 7 . 5)- 7 . 5 ≤ x ≤ - 6 . 5 1- ( x + 2 . 5) 2- 3 . 5 ≤ x ≤ - 1 . 50 e- 4( x- 2 . 5) 2- 1 . 25 ≤ x ≤ 6 . 25 1 6 . 5 ≤ x ≤ 8 . 5 otherwise (1) Print the x and f ( x ) in a two-column format, and pipe the output to a file called out.dat . Plot the function using matlab or octave. The commands to do so are $matlab matlab> x=load(’out.dat’); % read the 2-column file matlab> plot(x(:,1),x(:,2),’k’); % plot x vs f(x) matlab> xlabel(’x’); % label x-axis matlab> ylabel(’f(x)’); % label y-axis matlab> print -dpdf hwk2_1 % save plot to file hwk2_1.pdf. The octave commands are exactly the same as the matlab ones except the printing (last one) which becomes print(’hwk2_1.pdf’,’-dpdf’)print(’hwk2_1....
View Full Document

This note was uploaded on 01/08/2012 for the course MSC 321 taught by Professor Staff during the Fall '08 term at University of Miami.

Page1 / 3

hwk2_2011 - MSC321 Homework 2 Due February 11 1 Write a...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online