Question

In: Mechanical Engineering

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( , , )

Solutions

Expert Solution

A = linspace(0,4,5)

[O/P of this line will be A= 0 1 2 3 4 This command A = linspace(0,4,5) generates 5 points. The spacing between the points is (4-0)/(5-1). This means that we're asking for a linear spaced vector between 0 and 4 with 5-1=4 spaces or 5 points berween them. ]

B = 10

[This command takes a unit vector with value of 10]


C = B.^A

[O/P of this line will be C= 1 10 100 1000 10000

This command takes the element wise power operator to raise each element of B(since this is element wise array operation so even one element in B will multiply with each element in A) i.e. just one element to the corresponding power of A i.e. 5 values obtained in the first line command. So first 10 is raised to power 0, then 1, then 2, then 3, and then finally 4]


Related Solutions

2. Vector Element Calculation Write a MATLAB script which will randomly generate a 20-element vector with...
2. Vector Element Calculation Write a MATLAB script which will randomly generate a 20-element vector with integer values ranging between −100 to +100. Using LOOP command, determine the number of negative elements in the vector. For example, given A = [15 −6 0 -8 −2 5 4 −10 -3 −5], the number of negative numbers are 6.
MATLAB. A three vector force system has forces as outlined, use a three element vector to...
MATLAB. A three vector force system has forces as outlined, use a three element vector to represent the x, y, and z terms respectively, F = [x_value, y_value, z_value]. Find the resultant force when: F1 has a magnitude of 120 N and is in the x-y plane, 35 degrees BELOW the positive x axis, F2 has a magnitude of 810 N and is in the x-z plane, 100 degrees ABOVE the positive x axis, and F3 has a magnitude of...
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 matlab backslash operator to output the solution of system of equation.
Use matlab backslash operator to output the solution of system of equation.Print the unknowns in console.
Write a Matlab script that computes the element level stiffness matrix and force vector for linear...
Write a Matlab script that computes the element level stiffness matrix and force vector for linear elasticity.
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 Matlab to introduce arow vector,f,and define it as a 1 by 4 vector showing values...
Use Matlab to introduce arow vector,f,and define it as a 1 by 4 vector showing values of 1, 2, 3and 4. Now try to build matrix D, using the following 2 commands a.D = [f ; A] b.D= [f , A] c.Which one can be built,and which one cannot be built? Explain your answer. Matrix A, which is a 4by 4 matrix, (The first, second, third and fourth column values are:2,4,6,8and 1,3,5,7 and 8,6,4,2 and 7,5,3,1 , respectively.
Write a MATLAB function that accepts input vector x and returns the number of local maximums...
Write a MATLAB function that accepts input vector x and returns the number of local maximums of x with value between xmin and xmax. Ask user to input values xmin and xmax at the beginning of the procedure. Use vector x (the vector x from that file consists of 1000 numbers ranging from 0.0044 to 0.67).
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
matlab use matlab to calculate the velocity of the vertical falling ball (v) as a function...
matlab use matlab to calculate the velocity of the vertical falling ball (v) as a function of time by numerical derive the following measurement values.(x is height in meters and y is the landing time in milliseconds) Make sure that the speed in the starting point is 0. Then reset instantaneous velocity as a function of time in a diagram with matlab x=[0.00 0.20 0.40 0.60 0.80 1.00 1.20 1.50 2.00 2.50 3.00 3.40 3.80 4.20 4.60 5.0] y=[[0.00 1.620...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT