Question: 7 . Create a vector x with the elements, xn = ( 1 ) + 1 2 n 1 , where n = { 1

7. Create a vector x with the elements,
xn =
(1)
+1
2n1
, where n={1,2,3,...,100}
Then, add up the elements of the version of this vector that has 100 elements.
2
8. Make multi plots for the following two functions in one figure as shown below. Do not forget to add
the axis labels, a title, and grid.
f1(x)= sin(1/x) for 0.01< x <0.1.
f2(x)= cos(1/x) for 0.01< x <0.1.
[Code Hint]:
figure
subplot(2,2,1);
Add your code for plotting the sin(1/x) function
subplot(2,2,2);
Add your code for plotting the cos(1/x) function
subplot(2,2,3:4);
Add your code for plotting the two functions together (use hold on)
9. Create your own function that returns the inverse of your inputs.
For example, if your input vector, r, is equal to [3,4,5]. The output of your function must be [1/31/4
1/5].
Example:
>> r =[345] ;
>> b = your_function_name(r);
>> b
b=
0.33330.250.2
10. Given the vector x =[1,8,3,9,0,1], using for loop create a short set of commands that will
Add up the values of the elements.
11. Create a 4-by-7 array of random numbers (use rand). Move through the array, element by element,
and set any value that is less than -0.2 to 0 and any value that is greater than (or equal to)0.2 to 1.
12. Given x =[4,1,6] and y =[6,2,7], compute the following arrays
a) dij = xi/(2+ xi + yj)
b) eij = reciprocal of the lesser of xi and yj
13. Write a script that asks for a temperature (in degrees Fahrenheit) and computes the equivalent
temperature in degrees Celsius. The script should keep running until no number is provided to convert.
[Note: the function isempty will be useful here.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!