assign 1

1
Assignment No. 1 Section 2.1 1. a. Use two methods to create the vector x having 100 regularly spaced values starting at 5 and ending at 28. Sol: Either x = [5:23/99:28] or x = linspace(5,28,100) will work. b. Use two methods to create the vector x having a regular spacing of 0.2 starting at 2 and ending at 14. Sol: Either x = [2:0.2:14] or x=linspace(2,14,61) will work. c. Use two methods to create the vector x having 50 regularly spaced values starting at -2 and ending at 5. Sol: Either x = [-2:1/7:5] or Either x = linspace(-2,5,50) will work. 2. a. Create the vector x having 50 logarithmically spaced values starting at 10 and ending at 1000. Sol: logspace(1,3); 2.b. Create the vector x having 20 logarithmically spaced values starting at 10 and ending at 1000 Sol: logspace(1,3,20);

Upload: fakhre-alam

Post on 27-Nov-2014

366 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Assign 1

Assignment No. 1

Section 2.11. a. Use two methods to create the vector x having 100 regularly spacedvalues starting at 5 and ending at 28.

Sol: Either x = [5:23/99:28] or x = linspace(5,28,100) will work.

b. Use two methods to create the vector x having a regular spacing of 0.2starting at 2 and ending at 14.

Sol: Either x = [2:0.2:14] or x=linspace(2,14,61) will work.

c. Use two methods to create the vector x having 50 regularly spacedvalues starting at -2 and ending at 5.

Sol: Either x = [-2:1/7:5] or Either x = linspace(-2,5,50) will work.

2. a. Create the vector x having 50 logarithmically spaced values starting at 10 and ending at 1000.

Sol: logspace(1,3);

2.b. Create the vector x having 20 logarithmically spaced values starting at 10 and ending at 1000

Sol: logspace(1,3,20);