Code
Given Vector
x=[3 4 5 6]
a) Addding 10 to each element of given x
p=x+10
b)Adding 3 to odd index elements of x
q=x;
q(1:2:end)=q(1:2:end)+3
c) Square of each element of x
r=x.^2
Result
x =
3 4 5 6
p =
13 14 15 16
q =
6 4 8 6
r =
9 16 25 36
1. In MATLAB on your computer (preferably) or on a workstation, Let x = [3456] a)...
Compute the following problems using Math Lab. Instructions: Answer All Questions using MATLAB commands. Question 1. Create a vector of the even whole numbers between 31 and 75. Question 2. Let x [2516] a. Add 16 to each element b. Add 3 to just the odd-index elcments c. Compute the square root of each element d. Compute the square of each element Question 3. Let x 13 268T and y [4 1 3 5] (NB. x and y should be...
Any one has answered the question Write a computer program (preferably in MatLAB) to solve the following bar problem using finite element method. As shown in the figure below, the bar is fixed at the left and right ends. It is subjected to two forces as shown in the figure. The input to the code should be Material properties (Modulus of elasticity). 2. I. Length of the bar, L 3. Magnitudes and locations of Fi and F2 4. Number of...
matlab please Problem 3. / 30 points Let p(x) = C1 +222 + ... + -1. The value of p for a square matrix input is defined as p(X) - 17+ 2X + ... + CX- (a) (12 points) Show that if XeRkxk has an EVD, then p(x) can be found using only evaluations of p at the eigenvalues and two matrix multiplications. (b) (18 points) Complete the following program which, given coefficients c = (C1,C2,...,C.)", evaluates the corresponding polynomial...
Solve in MATLAB Problem 3: Given the vector x- [2 1 0 6 2 3 5 3 4 1 3 2 10 12 4 2 7 9 2 4 51 use a for loop to (a) Add up the values of all elements in x (b) Compute the cumulative sum, y, of elements in x You can check your results using the built-in functions sum and cumsum. Q.5 What is the value of the sum of elements in vector x?...
using matlab Given array x = [1, 23, 43, 72, 87, 56, 98, 33], use a for-loop to find the sum of the odd-valued elements of vector x (an odd number n satisfies the condition: mod(n,2) == 1).
Matlab code assistance - task 1 and 6 I think I am right and just need to be pointed in the right direction if I should change anything %% Task 1 % create the 3 row vectors shown in Ex 8 using 3 different approaches Ex 8 = using the colon operator and also the linspace function, create the following row vectors -5 -4 -3 -2 -1 5 7 9 8 6 4 % 1. list the values explicitly (square...
answer 8 using matlab Using nested loops, traverse through the matrix for the following. a) Replace all elements divisible by 3 with 100. b) Replace all elements divisible by 2 with 50. c) Replace the first element of each row with 10. d) Display the all elements of the 2D matrix as a 10 array (9 elements in 1 row) 8) Write a function file that determines the maximum element of an input matrix A using nested loops and counts...
please write the code on matlab using for loop Also practice using for loops to combine two vectors with the same number of elements. do in-between iterations one before the last iteration will have w/index=(last element-1)) = 4x(index=(last_element-1)) - 2(2) last iteration windex=last element)= 4*x[index=last element) - z(1) you need to figure out how to the change in index for vector z within the for loop.
matlab C = 1 1 li 1 0 1 11 1 1 D = 0001 0 0 0 1 lo 0 21 (6) Generate matrix C. Find the linear index of element equal to 0, and convert the linear index to subscript index. (7) Generate matrix D. Find the value of smallest element of D, and find the linear index of all these elements. (8) Calculate y-3'sin(x+2)+1, when x-(1,2...,10]
1. Write a MATLAB function that takes a matrix, a row number and a scalar as arguments and multiplies each element of the row of the matrix by the scalar returning the updated matrix. 2. Write a MATLAB function that takes a matrix, two row numbers and a scalar as arguments and returns a matrix with a linear combination of the rows. For example, if the rows passed to the function were i and j and the scalar was m,...