In: Mechanical Engineering
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( , , )
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]