hi friends ...how is all? any one can help me to find a solution for any part of this homework ...plz send me i need that ??my doctor need the solution next day and thx alot?
Name & ID: ........................................................I..c..e..r.t.ify that I did not receive any illegal aid in doing this homework
EE100 Homework # 6 Due Tuesday 2008.11.25
The homework has 7 questions.
Solve questions 1, 2 and 2 and submit your printed program and printed results
.
The rest of the questions needs preparation at home by reading several pages from the textbook and will be discussed
in the lab.
1. Use Pspice to solve drill problem 2.11a in HK5e page 99 to find the current i10 in the circuit.
2. (Chapman 5.9) Write three MatLab functions to calculate the hyperbolic sine sinh(x) = e
The rest of the questions needs preparation at home by reading several pages from the textbook and will be discussed
in the lab.
1. Use Pspice to solve drill problem 2.11a in HK5e page 99 to find the current i10 in the circuit.
2. (Chapman 5.9) Write three MatLab functions to calculate the hyperbolic sine sinh(x) = e
x
−
e
−
x
2
, cosine cosh(x) =
e
x
+e
−
1
2
, and tangent tanh(x) = e
x
−
e
−
x
e
x
+e−x functions. Write a calling program to test the three functions for the
values x=0, 1, and 10. Use your functions to plot the shapes of the hyperbolic sine, cosine, and tangent functions.
3. (Chapman 5.11) Sort with Carry. It is often useful to sort an array arr1 into ascending order, while simultaneously
carrying along a second array arr2. In such a sort, each time an element of array arr1 is exchanged with another
element of arr1, the corresponding elements of array arr2 are also swapped. When the sort is over, the elements of
array arr1 are in ascending order, whereas the elements of array arr2 that were associated with particular elements
of array arr1 are still associated with them. For example, suppose we have the following two arrays.
Element arr1 arr2
1 6 1
2 1 0
3 2 10
After sorting array arr1 while carrying along array arr2, the contents of the two arrays will be
Element arr1 arr2
1 1 0
2 2 10
3 6 1
Write a function to sort one real array into ascending order while carrying along a second one. Test the function
with the following two 9-element arrays.
values x=0, 1, and 10. Use your functions to plot the shapes of the hyperbolic sine, cosine, and tangent functions.
3. (Chapman 5.11) Sort with Carry. It is often useful to sort an array arr1 into ascending order, while simultaneously
carrying along a second array arr2. In such a sort, each time an element of array arr1 is exchanged with another
element of arr1, the corresponding elements of array arr2 are also swapped. When the sort is over, the elements of
array arr1 are in ascending order, whereas the elements of array arr2 that were associated with particular elements
of array arr1 are still associated with them. For example, suppose we have the following two arrays.
Element arr1 arr2
1 6 1
2 1 0
3 2 10
After sorting array arr1 while carrying along array arr2, the contents of the two arrays will be
Element arr1 arr2
1 1 0
2 2 10
3 6 1
Write a function to sort one real array into ascending order while carrying along a second one. Test the function
with the following two 9-element arrays.
a
−1 11 −6 17 −23 0 5 1 −1
b
−31 101 36 −17 0 10 −8 −1 −1
Test your results by applying the MatLab function ’sortrows’ on your data.
Page 1 of 2
Test your results by applying the MatLab function ’sortrows’ on your data.
Page 1 of 2
Please go on to the next page. . .
EE100 Homework # 6 Due Tuesday 2008.11.25
•
Reference Kuncicky pages 111-123 on polynomial: evaluation (polyval), add/subtract, multiply (conv), divide
(deconv), derivative (polyder), and roots (roots).
(deconv), derivative (polyder), and roots (roots).
•
Reference Kuncicky pages 91-100 on matrices: zeros, ones, array plotting (plot, semilogx, semilogy, loglog,
multiple plot of polynomial curves, multiple plot of polynomial curves with separate y axes) and the commands
axis, hold, grid, xlabel, ylabel, title, figure(n), close (figure), close(all), clf, and subplot(m,n,p) (m by n grid
of windows and p the current window).
4. x = rand returns a number between 0 and 1 drawn from a uniform distribution.
multiple plot of polynomial curves, multiple plot of polynomial curves with separate y axes) and the commands
axis, hold, grid, xlabel, ylabel, title, figure(n), close (figure), close(all), clf, and subplot(m,n,p) (m by n grid
of windows and p the current window).
4. x = rand returns a number between 0 and 1 drawn from a uniform distribution.
y
= −1 + 2 rand returns a number between 0 and 1.
In general y = a + (b − a) rand returns a number between a and b.
Flipping a coin (Kuncicky page 149): if Head=1, Tail=0 then coin = floor(2 rand) will return 0 or 1.
toss=[]; for k=1:1:1000, toss=[toss; floor(2*rand)]; end
will return 1000 integers each having the value 0 or 1 (Tail or Head). If the function rand generates uniformly
distributed random numbers between 0 and 1 [0,1), then the average of the vector toss should be around 0.5 and
its variance should be 1
4 and the standard deviation =pV ariance = 1
2 . Verify the values for the mean, variance
and standard deviation using the MatLab functions mean(toss), var(toss), and std(toss).
5. (Chapman 5.6) Write a function that uses function rand to generate a random value in the range [low, high),
where low and high are passed as calling arguments. Write a program to test your function by generating 10000
numbers for low=-2, high=17 and follow the procedure as in the previous question for the mean, variance, and
standard deviation.
In general y = a + (b − a) rand returns a number between a and b.
Flipping a coin (Kuncicky page 149): if Head=1, Tail=0 then coin = floor(2 rand) will return 0 or 1.
toss=[]; for k=1:1:1000, toss=[toss; floor(2*rand)]; end
will return 1000 integers each having the value 0 or 1 (Tail or Head). If the function rand generates uniformly
distributed random numbers between 0 and 1 [0,1), then the average of the vector toss should be around 0.5 and
its variance should be 1
4 and the standard deviation =pV ariance = 1
2 . Verify the values for the mean, variance
and standard deviation using the MatLab functions mean(toss), var(toss), and std(toss).
5. (Chapman 5.6) Write a function that uses function rand to generate a random value in the range [low, high),
where low and high are passed as calling arguments. Write a program to test your function by generating 10000
numbers for low=-2, high=17 and follow the procedure as in the previous question for the mean, variance, and
standard deviation.