Question

In: Advanced Math

Use one MATLAB statement to generate each of the following scalars and vectors. (These parts are...

Use one MATLAB statement to generate each of the following scalars and vectors. (These parts are sequential)

a.) Generate the vector x=(sin5,sin10,sin15,...,sin200) but dont print

b.)Find the Max value in X and which index has this value. Print both the index and the value using Disp (so you can use 2 statements)

c.)Find the minimum value x and which index has this value. Print both the index and the value using Disp (so you can use 2 statements)

d.)Find the difference between the max and min values

e.) find the sum of all the elements of x

f.)find the sum of the absolute value of all the succesive elements of x

g.) find the differences between all the successive elements of x

h.)Find the absolute differences between all the successive elements of x

k.) sort all these elements in increasing order. print this out in two columns. The first containing the values and the second containing the indicies in x where these values occur (so you can use 2 statements.)

l.) Print out the product of all the elements in x, the mean value of these elemnets and their srtandard deviation, and only 1 statement is allowed.

Solutions

Expert Solution

Code in MATLAB :

A = zeros(20,1);

for i=1:20

A(i)= sin(5*i);

end

maximum = max(A);

max_index = find(A == maximum);

disp(maximum);

disp(max_index);

minimum = min(A);

min_index = find(A ==minimum);

disp(minimum);

disp(min_index);

difference = maximum - minimum;

sum_A = sum(A);

absolute_sum_A = (sum(abs(A)));

A_differences = zeros(19,1);

A_abs_differences = zeros(19,1);

for i=1:19

A_abs_differences(i) = abs(A(i+1)-A(i));

   A_differences(i) = (A(i+1)-A(i));

end

A_sorted = sort(A);

A_sorted_index = zeros(20,1);

for i=1:20

A_sorted_index(i) = find(A == A_sorted(i));

end

disp(A_sorted);

disp(A_sorted_index);

product = 1;

for i=1:20

product = product*A(i);

end

mean_value = mean(A);

standard_deviation = std(A);

fprintf('The product is %f \nMean value is %f\nStandard Deviation is %f\n',product,mean_value,standard_deviation);


Related Solutions

Write a MATLAB assignment statement for each of the following functions, assuming that w, x, y, and z are row vectors of equal length and that c and d are scalars.
Write a MATLAB assignment statement for each of the following functions, assuming that w, x, y, and z are row vectors of equal length and that c and d are scalars.
Which of the following properties are vectors and which are scalars considering a three-dimensional space? Give...
Which of the following properties are vectors and which are scalars considering a three-dimensional space? Give a “typical” symbol and the S.I. units used to describe these properties, i.e. if I asked for mass density you would answer: ρ is a scalar in units g cm3 = 103 kg m3 ; maybe even state ρ = m V . a) force b) mass c) angular displacement d) energy e) linear acceleration f) the period of a pendulum g) work h)...
Use Matlab to find a subset of the set of vectors that forms a basis for...
Use Matlab to find a subset of the set of vectors that forms a basis for the span of the vectors. (a) {(1, 2, −1, 0), (−3, −6, 3, 0), (1, 0, 0, 1), (−2, −2, 1, −1)}
Use the sine wave and scope in the Simulink library (MATLAB) to generate and observe the...
Use the sine wave and scope in the Simulink library (MATLAB) to generate and observe the following waves: a. ?1 (?) = sin ?? b. ?2 (?) = cos ?? c. ?2 (?) = 0.5 cos ?? d. ?3 (?) = cos (?? − ?) ? = 1 ???/s
Use normal vectors to determine the intersection, if any, for each of the following groups of...
Use normal vectors to determine the intersection, if any, for each of the following groups of three planes. Give a geometric interpretation in each case and the number of solutions for the corresponding linear system of equations. If the planes intersect in a line, determine a vector equation of the line. If the planes intersect in a point, determine the coordinates of the point. a x + 2y + 3z = −4 b x + 2y + 3z = −4...
The language is MATLAB Write a function that will generate three random integers, each in the...
The language is MATLAB Write a function that will generate three random integers, each in the inclusive range from 10 to 80. It will then return a string consisting of the three integers joined together, and also a character vector consisting of the three integers joined together. For example, if the random integers are 11, 29, and 76, the string that is returned will be "112976" and the character vector that is returned will be '112976'. I'm really confused on...
Use and provide Matlab for the following: Generate the discrete-time signal x[n] = 4 cos (2pi....
Use and provide Matlab for the following: Generate the discrete-time signal x[n] = 4 cos (2pi. 10. nT5) + 2cos(2pi. 100. nT5) + 3cos(2pi 200. nT's), with Ts0.001 sec. Display the signal in both time and frequency-domain. Assume that the 100 Hz component of x [n] is your desired signal while the other two components are noise. Design a suitable filter to extract the desired (i.e. 100 Hz) signal. Display the filter's response. Display the output signal in the frequency-domain....
In MatLab use the linspace function and the element-wise exponentiation (power) operator to generate the vector...
In MatLab use the linspace function and the element-wise exponentiation (power) operator to generate the vector 1, 10, 100, 1000, 10000 Please give the answer in form of linspace( , , )
Write a matlab code for given task Use your ‘sin’ or ‘cos’ function to generate a...
Write a matlab code for given task Use your ‘sin’ or ‘cos’ function to generate a sinusoid wave having two components as f1 = 3kHz and f2 = 5kHz and then sample it with fs = 10kHz. Calculate its fft with zero frequency component in the middle. Plot it on a properly scaled w-axis. Specify if there is aliasing or not? If there is aliasing specify which component is casing the aliasing
Use the following statement in the subsequent parts of the question: “If Ann is Jan’s mother,...
Use the following statement in the subsequent parts of the question: “If Ann is Jan’s mother, then Jose is Jan’s cousin.” a) Write the converse, inverse, and contrapositive of the statement. b) Show that the statement and the contrapositive are equivalent. c) Show that the converse and inverse are equivalent. d) Based on your findings, is the inverse equivalent to the contrapositive? Justify your answer.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT